Recent Advances in Layered MX2-Based Materials (M = Mo, W and X = S, Se, Te) for Emerging Optoelectronic and Photo(electro)catalytic Applications