How to switch off XIAO ESP32C3 when battery power is lower than 3v?


What is the best way not to destroy the rechargeable battery to not let it go under 3v ?
How can I close all circuitry including XIAO and also L298N when battery is too low ?

Thank you