mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-02 10:34:55 +00:00
improve responsiveness
This commit is contained in:
@@ -180,7 +180,6 @@ export function LauncherGroupSection({
|
||||
<LauncherResourceList
|
||||
resources={resources}
|
||||
showLabels={config.showLabels}
|
||||
showSiteTags={config.showSiteTags}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
|
||||
@@ -48,7 +48,7 @@ export function LauncherGroupTrigger({
|
||||
isOpen
|
||||
}: LauncherGroupTriggerProps) {
|
||||
return (
|
||||
<CollapsibleTrigger className="sticky top-0 z-20 md:top-16 flex w-full items-center gap-2.5 rounded-md bg-accent px-4 py-2.5 text-left transition-colors cursor-pointer">
|
||||
<CollapsibleTrigger className="flex w-full items-center gap-2.5 rounded-md bg-accent px-4 py-2.5 text-left transition-colors cursor-pointer">
|
||||
{group.groupType === "site" || group.groupType === "label" ? (
|
||||
<LauncherGroupStatusDot group={group} />
|
||||
) : null}
|
||||
|
||||
@@ -6,13 +6,11 @@ import { LauncherResourceRow } from "./LauncherResourceRow";
|
||||
type LauncherResourceListProps = {
|
||||
resources: LauncherResource[];
|
||||
showLabels: boolean;
|
||||
showSiteTags: boolean;
|
||||
};
|
||||
|
||||
export function LauncherResourceList({
|
||||
resources,
|
||||
showLabels,
|
||||
showSiteTags
|
||||
showLabels
|
||||
}: LauncherResourceListProps) {
|
||||
return (
|
||||
<div className="w-full max-md:overflow-x-auto max-md:overflow-y-hidden">
|
||||
@@ -22,7 +20,6 @@ export function LauncherResourceList({
|
||||
key={resource.launcherResourceKey}
|
||||
resource={resource}
|
||||
showLabels={showLabels}
|
||||
showSiteTags={showSiteTags}
|
||||
isLast={index === resources.length - 1}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { LabelBadge } from "@app/components/label-badge";
|
||||
import { cn } from "@app/lib/cn";
|
||||
import type { LauncherResource } from "@server/routers/launcher/types";
|
||||
import { LauncherLabelsRow } from "./LauncherLabelsRow";
|
||||
@@ -14,19 +13,15 @@ import {
|
||||
type LauncherResourceRowProps = {
|
||||
resource: LauncherResource;
|
||||
showLabels: boolean;
|
||||
showSiteTags: boolean;
|
||||
isLast?: boolean;
|
||||
};
|
||||
|
||||
export function LauncherResourceRow({
|
||||
resource,
|
||||
showLabels,
|
||||
showSiteTags,
|
||||
isLast = false
|
||||
}: LauncherResourceRowProps) {
|
||||
const hasTags =
|
||||
(showSiteTags && resource.site) ||
|
||||
(showLabels && resource.labels.length > 0);
|
||||
const hasTags = showLabels && resource.labels.length > 0;
|
||||
const { handleAction, isClickable } = useLauncherResourceAction({
|
||||
accessUrl: resource.accessUrl,
|
||||
accessCopyValue: resource.accessCopyValue
|
||||
@@ -45,24 +40,15 @@ export function LauncherResourceRow({
|
||||
role={clickProps.role}
|
||||
tabIndex={clickProps.tabIndex}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
"flex shrink-0 items-center gap-2.5",
|
||||
"max-md:sticky max-md:left-0 max-md:z-10 max-md:min-w-[9rem]",
|
||||
"max-md:-my-4 max-md:-ml-4 max-md:py-4 max-md:pl-4 max-md:pr-3",
|
||||
"max-md:bg-card max-md:[mask-image:linear-gradient(to_left,transparent_0%,black_20px)]"
|
||||
)}
|
||||
>
|
||||
<LauncherResourceIcon
|
||||
iconUrl={resource.iconUrl}
|
||||
name={resource.name}
|
||||
variant="list"
|
||||
/>
|
||||
<LauncherResourceIcon
|
||||
iconUrl={resource.iconUrl}
|
||||
name={resource.name}
|
||||
variant="list"
|
||||
/>
|
||||
|
||||
<span className="text-sm font-semibold text-foreground">
|
||||
{resource.name}
|
||||
</span>
|
||||
</div>
|
||||
<span className="shrink-0 text-sm font-semibold text-foreground">
|
||||
{resource.name}
|
||||
</span>
|
||||
|
||||
<LauncherResourceAccess
|
||||
accessDisplay={resource.accessDisplay}
|
||||
@@ -73,21 +59,11 @@ export function LauncherResourceRow({
|
||||
|
||||
{hasTags ? (
|
||||
<div className="flex min-w-0 max-w-md shrink items-center justify-end gap-1 max-md:shrink-0 max-md:max-w-none md:ml-auto">
|
||||
{showSiteTags && resource.site ? (
|
||||
<LabelBadge
|
||||
name={resource.site.name}
|
||||
color="#a1a1aa"
|
||||
displayOnly
|
||||
className="shrink-0"
|
||||
/>
|
||||
) : null}
|
||||
{showLabels ? (
|
||||
<LauncherLabelsRow
|
||||
labels={resource.labels}
|
||||
variant="single-row"
|
||||
className="w-auto shrink-0 justify-end"
|
||||
/>
|
||||
) : null}
|
||||
<LauncherLabelsRow
|
||||
labels={resource.labels}
|
||||
variant="single-row"
|
||||
className="w-auto shrink-0 justify-end"
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -115,21 +115,6 @@ export function LauncherSettingsMenu({
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<Label
|
||||
htmlFor="show-site-tags"
|
||||
className="text-sm font-semibold"
|
||||
>
|
||||
{t("resourceLauncherShowSiteTags")}
|
||||
</Label>
|
||||
<Switch
|
||||
id="show-site-tags"
|
||||
checked={config.showSiteTags}
|
||||
onCheckedChange={(checked) =>
|
||||
onConfigChange({ showSiteTags: checked })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!isDefaultView ? (
|
||||
|
||||
@@ -372,7 +372,7 @@ export default function ResourceLauncher({
|
||||
|
||||
<div className="flex flex-col gap-3 mb-6">
|
||||
<div className="flex flex-col gap-3 xl:flex-row xl:items-center xl:justify-between">
|
||||
<div className="flex items-center gap-2 shrink-0 justify-start xl:justify-end order-1 sm:order-2 xl:order-2">
|
||||
<div className="flex items-center gap-2 shrink-0 justify-start xl:justify-end order-1 xl:order-2">
|
||||
<LauncherSaveViewMenu
|
||||
isDefaultView={isDefaultView}
|
||||
isAdmin={isAdmin}
|
||||
@@ -420,7 +420,7 @@ export default function ResourceLauncher({
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-3 min-w-0 flex-1 order-2 sm:order-1 xl:order-1">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-3 min-w-0 flex-1 order-2 xl:order-1">
|
||||
<div className="relative w-full sm:max-w-sm shrink-0">
|
||||
<Search className="absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" />
|
||||
<Input
|
||||
|
||||
@@ -18,7 +18,6 @@ export type LauncherUrlConfigOverrides = Partial<
|
||||
| "layout"
|
||||
| "order"
|
||||
| "showLabels"
|
||||
| "showSiteTags"
|
||||
| "siteIds"
|
||||
| "labelIds"
|
||||
| "query"
|
||||
@@ -43,7 +42,6 @@ const LAUNCHER_CONFIG_PARAM_KEYS = [
|
||||
"layout",
|
||||
"order",
|
||||
"showLabels",
|
||||
"showSiteTags",
|
||||
"siteIds",
|
||||
"labelIds"
|
||||
] as const;
|
||||
@@ -137,14 +135,6 @@ function parseConfigOverrides(
|
||||
}
|
||||
}
|
||||
|
||||
const showSiteTags = searchParams.get("showSiteTags");
|
||||
if (showSiteTags !== null) {
|
||||
const parsed = launcherUrlBooleanSchema.safeParse(showSiteTags);
|
||||
if (parsed.success) {
|
||||
overrides.showSiteTags = parsed.data;
|
||||
}
|
||||
}
|
||||
|
||||
const siteIds = searchParams.get("siteIds");
|
||||
if (siteIds !== null) {
|
||||
overrides.siteIds = parseIdListParam(siteIds);
|
||||
@@ -263,10 +253,6 @@ export function serializeLauncherUrlState({
|
||||
params.set("showLabels", config.showLabels ? "1" : "0");
|
||||
}
|
||||
|
||||
if (config.showSiteTags !== baseConfig.showSiteTags) {
|
||||
params.set("showSiteTags", config.showSiteTags ? "1" : "0");
|
||||
}
|
||||
|
||||
if (!idListsEqual(config.siteIds, baseConfig.siteIds)) {
|
||||
if (config.siteIds.length > 0) {
|
||||
params.set("siteIds", config.siteIds.join(","));
|
||||
|
||||
Reference in New Issue
Block a user