You may need to replace the joycon shell. The ribbon cable ends appear to be intact, you will need to take apart the joycon shell and see if the ribbon locks are still good.
Theyre highlighted here on step 6
https://www.ifixit.com/Guide/Left+Joy-Con+Charging+Rail+Replacement/142938
On the bottom of the rail you see that little bit of red plastic? Thats the screw hole for the rail. You will need to remove the screw and throw away that broken piece. That one screw holds most of the tension for the rail, which unfortunately makes the whole shell useless.
Then transplant the internals into a new joycon shell. You have lots of options.
https://www.ifixit.com/Guide/Nintendo+Switch+Right+Joy-Con+Shell+Replacement/130386