allow grouping when filter applied

This commit is contained in:
miloschwartz
2026-07-02 22:07:30 -04:00
parent 1717a99cee
commit 12f9ac94fd
5 changed files with 37 additions and 19 deletions

View File

@@ -3613,7 +3613,7 @@
"resourceLauncherSiteGroupingDisabled": "Site grouping is unavailable at this scale. Filter by site to group a smaller set.",
"resourceLauncherLabelGroupingDisabled": "Label grouping is unavailable at this scale.",
"resourceLauncherCompactModeHint": "Showing a simplified list for faster browsing. Use search or filters to narrow results.",
"resourceLauncherCompactGroupingLocked": "Grouping is set to None in compact mode.",
"resourceLauncherCompactGroupingHint": "Apply site or label filters to enable grouping in compact mode.",
"resourceLauncherCopiedToClipboard": "Copied to clipboard",
"resourceLauncherCopiedAccessDescription": "Resource access has been copied to your clipboard.",
"resourceLauncherViewNamePlaceholder": "View name",

View File

@@ -76,6 +76,7 @@ async function getLauncherScaleForUserUncached(
: "compact";
const siteFilterIds = parseIdListParam(query.siteIds);
const labelFilterIds = parseIdListParam(query.labelIds);
const allowSiteGrouping =
siteGroupCount <= LAUNCHER_FULL_MAX_SITE_GROUPS ||
@@ -83,7 +84,9 @@ async function getLauncherScaleForUserUncached(
siteFilterIds.length <= LAUNCHER_FILTERED_SITE_GROUPING_MAX);
const allowLabelGrouping =
labelGroupCount <= LAUNCHER_FULL_MAX_LABEL_GROUPS;
labelGroupCount <= LAUNCHER_FULL_MAX_LABEL_GROUPS ||
(labelFilterIds.length > 0 &&
labelFilterIds.length <= LAUNCHER_FILTERED_SITE_GROUPING_MAX);
const requireSearchOrFilter =
mode === "compact" && resourceCount > LAUNCHER_FULL_MAX_RESOURCES;

View File

@@ -78,8 +78,9 @@ export function LauncherSettingsMenu({
<SelectItem
value="site"
disabled={
isCompactMode ||
!capabilities.allowSiteGrouping
!capabilities.allowSiteGrouping ||
(isCompactMode &&
config.siteIds.length === 0)
}
>
{t("resourceLauncherGroupBySite")}
@@ -87,8 +88,9 @@ export function LauncherSettingsMenu({
<SelectItem
value="label"
disabled={
isCompactMode ||
!capabilities.allowLabelGrouping
!capabilities.allowLabelGrouping ||
(isCompactMode &&
config.labelIds.length === 0)
}
>
{t("resourceLauncherGroupByLabel")}
@@ -97,7 +99,7 @@ export function LauncherSettingsMenu({
</Select>
{isCompactMode ? (
<p className="text-xs text-muted-foreground">
{t("resourceLauncherCompactGroupingLocked")}
{t("resourceLauncherCompactGroupingHint")}
</p>
) : null}
{!isCompactMode && !capabilities.allowSiteGrouping ? (

View File

@@ -549,12 +549,6 @@ export default function ResourceLauncher({
</div>
)}
{scale.mode === "compact" && !showSearchFirstGate ? (
<p className="mb-4 text-sm text-muted-foreground">
{t("resourceLauncherCompactModeHint")}
</p>
) : null}
{showSearchFirstGate ? (
<LauncherSearchFirstGate layout={config.layout} />
) : showGroupList ? (

View File

@@ -15,11 +15,27 @@ export function getEffectiveGroupBy(
scale: LauncherScaleInfo,
config: LauncherViewConfig
): LauncherViewConfig["groupBy"] {
if (scale.mode === "compact") {
return "none";
if (scale.mode !== "compact") {
return config.groupBy;
}
return config.groupBy;
if (
config.groupBy === "site" &&
config.siteIds.length > 0 &&
scale.capabilities.allowSiteGrouping
) {
return "site";
}
if (
config.groupBy === "label" &&
config.labelIds.length > 0 &&
scale.capabilities.allowLabelGrouping
) {
return "label";
}
return "none";
}
export function getEffectiveLauncherConfig(
@@ -49,9 +65,12 @@ export function shouldFetchLauncherGroups(
}
return (
scale.capabilities.allowSiteGrouping &&
groupBy === "site" &&
config.siteIds.length > 0
(scale.capabilities.allowSiteGrouping &&
groupBy === "site" &&
config.siteIds.length > 0) ||
(scale.capabilities.allowLabelGrouping &&
groupBy === "label" &&
config.labelIds.length > 0)
);
}