feat(studio): add 'only unplaced items' filter toggle to organize imports dialog
This commit is contained in:
1 parent
0f1da6c178
commit
fdc7a48ef4
3 files changed
+17
-4
No files matched your search
@@ -124,6 +124,7 @@ export function OrganizeImportsDialog({
|
||||
const [points, setPoints] = useState(0);
|
||||
const [pointsType, setPointsType] = useState(0);
|
||||
const [groupSearchQuery, setGroupSearchQuery] = useState("");
|
||||
const [onlyUnplaced, setOnlyUnplaced] = useState(false);
|
||||
const [batchLayout, setBatchLayout] = useState<CatalogLayout>("default_3x3");
|
||||
const [batchPrefix, setBatchPrefix] = useState("");
|
||||
|
||||
@@ -284,14 +285,15 @@ export function OrganizeImportsDialog({
|
||||
|
||||
const filteredGroups = useMemo(() => {
|
||||
const q = groupSearchQuery.trim().toLowerCase();
|
||||
if (!q) return groups;
|
||||
return groups.filter((g) => {
|
||||
if (onlyUnplaced && g.added === 0 && g.moved === 0) return false;
|
||||
if (!q) return true;
|
||||
if (g.name.toLowerCase().includes(q)) return true;
|
||||
const caption = overrides[g.name]?.caption?.toLowerCase();
|
||||
if (caption?.includes(q)) return true;
|
||||
return g.thumbs.some((t) => t.itemName.toLowerCase().includes(q));
|
||||
});
|
||||
}, [groups, groupSearchQuery, overrides]);
|
||||
}, [groups, groupSearchQuery, onlyUnplaced, overrides]);
|
||||
|
||||
const handleCreate = async () => {
|
||||
if (isCreating) return;
|
||||
@@ -624,6 +626,15 @@ export function OrganizeImportsDialog({
|
||||
onChange={(e) => setGroupSearchQuery(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<label className="flex cursor-pointer items-center gap-1.5 select-none rounded border bg-background/50 px-2 py-1.5 text-[10px] text-muted-foreground transition-colors hover:text-foreground">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={onlyUnplaced}
|
||||
onChange={(e) => setOnlyUnplaced(e.target.checked)}
|
||||
className="h-3 w-3 rounded border-gray-300"
|
||||
/>
|
||||
<span>{t("onlyUnplaced")}</span>
|
||||
</label>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
|
||||
@@ -2244,7 +2244,8 @@
|
||||
"applyBatch": "Apply to all",
|
||||
"searchGroups": "Filter import groups...",
|
||||
"visualPreview": "Preview",
|
||||
"resetAll": "Reset overrides"
|
||||
"resetAll": "Reset overrides",
|
||||
"onlyUnplaced": "Only show unplaced items"
|
||||
}
|
||||
},
|
||||
"bulk": {
|
||||
|
||||
@@ -2012,7 +2012,8 @@
|
||||
"applyBatch": "Toepassen op alle",
|
||||
"searchGroups": "Filter importgroepen...",
|
||||
"visualPreview": "Voorbeeld",
|
||||
"resetAll": "Wijzigingen herstellen"
|
||||
"resetAll": "Wijzigingen herstellen",
|
||||
"onlyUnplaced": "Toon alleen ongeplaatste items"
|
||||
}
|
||||
},
|
||||
"bulk": {
|
||||
|
||||
Reference in new issue
Block a user