Phone randomly shuts down after screen and battery replacement
So, here's the problem: the phone shuts down randomly after changing screen, battery and charging port.
I have replaced the screen because the glass was broken but the touchscreen still worked fine, so that shouldn't be the problem.
The charging port was replaced because I broke the connector by mistake while removing it (I checked the connector on the motherboard by taking a picture and zooming it and everything seemed fine).
The battery was changed for obious reasons.
Everything seems to work fine, but the phone randomly shuts down. While using it, the notification bar disappears all of a sudden, the phone shows the "loading sign" and then it shuts down.
If I try to turn it on again, it usually doesn't turn on, saying the battery is dead and I need to recharge the phone. If I try 3 to 5 times, it usually turns back on. If I connect the phone to the charger, it turns immediately (after pushing the power button) on.
What could be the problem?