How to safely interface 220VAC in a PCB
Low consumer quality boards are done like this.



Since dust and moisture accumulation causes greatly reduced breakdown voltages down from 1kV/mm, it is far better to have an air gap milled in the board between primary and secondary of the Opto.



However , your external schematic is nonsense with Line Neutral and switch going to LED.