So while they have majority support, it's not like they've had any real alternative.
https://slate.com/news-and-politics/2023/10/was-hamas-electe...
Additionally, the state of palestine is not a party to this case.
So no, the icj cannot tell hamas to do anything. The only people it can give orders to in this case are israel and south africa.
Hamas's crines are the juridsiction of the ICC.
You could argue they should be, but what is and what should be are entirely different things.