Exploring optical and optoelectronic properties in transition metal dichalcogenides