mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 10:51:02 +01:00
fix: persist format card description/condition visibility in local storage
This commit is contained in:
@@ -14,7 +14,10 @@ function FormatCard({
|
||||
willBeSelected,
|
||||
onSelect
|
||||
}) {
|
||||
const [showDescription, setShowDescription] = useState(true);
|
||||
const [showDescription, setShowDescription] = useState(() => {
|
||||
const saved = localStorage.getItem(`format-view-${format.file_name}`);
|
||||
return saved !== null ? JSON.parse(saved) : true;
|
||||
});
|
||||
const {content} = format;
|
||||
const totalTests = content.tests?.length || 0;
|
||||
const passedTests = content.tests?.filter(t => t.passes)?.length || 0;
|
||||
@@ -45,7 +48,14 @@ function FormatCard({
|
||||
|
||||
const handleViewToggle = e => {
|
||||
e.stopPropagation();
|
||||
setShowDescription(!showDescription);
|
||||
setShowDescription(prev => {
|
||||
const newState = !prev;
|
||||
localStorage.setItem(
|
||||
`format-view-${format.file_name}`,
|
||||
JSON.stringify(newState)
|
||||
);
|
||||
return newState;
|
||||
});
|
||||
};
|
||||
|
||||
const handleMouseDown = e => {
|
||||
|
||||
Reference in New Issue
Block a user