This depends entirely on battery chemistry and is different for each one.
Lithium ion batteries want to be stored at low charge and cold. As long as they don’t self discharge below a certain minimum (at which point they are dead forever) you minimize degradation by keeping charge as low as possible. No need to be obsessive about it because the difference between 5% and 50% isn’t much.
Other lithium chemistries want to be stored completely charged, NiCd wants to be about half. Temperature is usually worse than charge state anyway.
Lithium ion batteries want to be stored at low charge and cold. As long as they don’t self discharge below a certain minimum (at which point they are dead forever) you minimize degradation by keeping charge as low as possible. No need to be obsessive about it because the difference between 5% and 50% isn’t much.
Other lithium chemistries want to be stored completely charged, NiCd wants to be about half. Temperature is usually worse than charge state anyway.