The i5-8300HQ is definitely the more powerful CPU because it can turbo boost up to 4.0GHz (when one core is used) compared to 3.5GHz that the i5-7300HQ is capable of reaching (also only on one core). The i5-8300HQ also has Hyper Threading (HT) which allows each core to process two threads of instructions instead of only one that the i5-7300HQ is capable of.
However... the vast majority of games do not benefit from HT. Additionally, the vast majority of games benefits more from a more powerful GPU as opposed to a more powerful CPU. I am aware of only two games that can take advantage of HT; Overwatch and the most recent Rainbow Six. But not enough to compensate for the fact that the GTX 1050 Ti is more powerful than the GTX 1050.