Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ import * as React from "react";
|
||||
import { describe, it } from "vitest";
|
||||
|
||||
import { Alert, AlertDescription, AlertTitle } from "./alert";
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
|
||||
describe("Alert axe-core a11y", () => {
|
||||
it("info alert has no axe violations", async () => {
|
||||
|
||||
+2
-2
@@ -4,12 +4,12 @@ import { describe, it } from "vitest";
|
||||
|
||||
import { Button } from "./button";
|
||||
import BackButtonWithTitle from "./buttons/BackButtonWithTitle";
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
|
||||
/**
|
||||
* Complementary to button.a11y.test.tsx (which uses the static helper at
|
||||
* apps/web/app/utils/test/a11y.tsx). This file runs the full axe-core engine
|
||||
* via @toolctrl/ui-app/test-setup/axe to catch issues the static heuristic
|
||||
* via @hivegrid/ui-app/test-setup/axe to catch issues the static heuristic
|
||||
* can't (e.g. aria-disabled vs disabled, redundant roles).
|
||||
*/
|
||||
describe("Button axe-core a11y", () => {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import * as React from "react";
|
||||
import { describe, it } from "vitest";
|
||||
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./card";
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
|
||||
describe("Card axe-core a11y", () => {
|
||||
it("Card with header + content has no axe violations", async () => {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { describe, it } from "vitest";
|
||||
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./dialog";
|
||||
import { Button } from "./button";
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
|
||||
describe("Dialog axe-core a11y", () => {
|
||||
it("open dialog with title + description has no axe violations", async () => {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { describe, it } from "vitest";
|
||||
import { Button } from "./button";
|
||||
import { Input } from "./input";
|
||||
import { Label } from "./label";
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
|
||||
describe("Form composition axe-core a11y", () => {
|
||||
it("login-shaped form (label/input/required/submit) has no axe violations", async () => {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { describe, it } from "vitest";
|
||||
|
||||
import { Input } from "./input";
|
||||
import { Label } from "./label";
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
|
||||
describe("Input axe-core a11y", () => {
|
||||
it("paired with a <Label htmlFor> has no axe violations", async () => {
|
||||
|
||||
+13
-1
@@ -93,7 +93,11 @@ describe("CommandPalette", () => {
|
||||
});
|
||||
|
||||
function openPalette() {
|
||||
fireEvent.keyDown(document, { key: "k", metaKey: true });
|
||||
fireEvent.keyDown(window, { key: "k", metaKey: true });
|
||||
}
|
||||
|
||||
function openPaletteWithCtrl() {
|
||||
fireEvent.keyDown(window, { key: "k", ctrlKey: true });
|
||||
}
|
||||
|
||||
it("passes the filtered registry-backed actions through for the active layout context", async () => {
|
||||
@@ -126,6 +130,14 @@ describe("CommandPalette", () => {
|
||||
expect(state.getCommandRegistryActions).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("opens from the Windows/Linux Ctrl+K shortcut", async () => {
|
||||
renderPalette();
|
||||
openPaletteWithCtrl();
|
||||
|
||||
await screen.findByText("Dashboard", undefined, { timeout: 4000 });
|
||||
expect(screen.getByText("Denied Looking")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders a safe empty path when app/root data is missing", async () => {
|
||||
const state = globalThis.__commandPaletteTest;
|
||||
state.useAppOrAdminData.mockReturnValue(undefined);
|
||||
|
||||
+2
-2
@@ -41,8 +41,8 @@ export default function CommandPalette({ layout, children, actions }: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("keydown", onKeyDown);
|
||||
return () => document.removeEventListener("keydown", onKeyDown);
|
||||
window.addEventListener("keydown", onKeyDown);
|
||||
return () => window.removeEventListener("keydown", onKeyDown);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
+131
-1
@@ -1,12 +1,17 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useFetcher, useNavigate } from "react-router";
|
||||
import { UI_SURFACE_IDS } from "~/application/ui/uiRegistry";
|
||||
import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "~/components/ui/command";
|
||||
import type { GlobalSearchEntityType, GlobalSearchResponse } from "~/services/search/globalSearch.server";
|
||||
import { getCommandRegistryActions, type CommandRegistryLayout, type ScopedCommandAction } from "~/services/command-registry/commandRegistry";
|
||||
import { appPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import type { AppLoaderData } from "~/utils/data/useAppData";
|
||||
import { useAppOrAdminData } from "~/utils/data/useAppOrAdminData";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
|
||||
const globalSearchEntityTypes: GlobalSearchEntityType[] = ["contact", "company", "lead", "project", "file", "task", "user"];
|
||||
|
||||
export default function CommandPaletteDialog({
|
||||
actions,
|
||||
layout,
|
||||
@@ -21,8 +26,34 @@ export default function CommandPaletteDialog({
|
||||
const { t, i18n } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const fetcher = useFetcher();
|
||||
const searchFetcher = useFetcher<GlobalSearchResponse>();
|
||||
const appData = useAppOrAdminData() as AppLoaderData | undefined;
|
||||
const rootData = useRootData();
|
||||
const [query, setQuery] = useState("");
|
||||
const [selectedEntityTypes, setSelectedEntityTypes] = useState<GlobalSearchEntityType[]>(globalSearchEntityTypes);
|
||||
const canUseGlobalSearch = layout === "app" && !!appData?.currentTenant?.slug && appData.permissions?.includes("search.use");
|
||||
const trimmedQuery = query.trim();
|
||||
const searchResults = searchFetcher.data?.query === trimmedQuery ? (searchFetcher.data.results ?? []) : [];
|
||||
const recentSearches = searchFetcher.data?.query === "" ? (searchFetcher.data.recentSearches ?? []) : [];
|
||||
const activeTypeParams = useMemo(() => selectedEntityTypes.map((type) => `type=${encodeURIComponent(type)}`).join("&"), [selectedEntityTypes]);
|
||||
const allResultsHref = useMemo(() => {
|
||||
if (!appData?.currentTenant?.slug) return "";
|
||||
const suffix = activeTypeParams ? `&${activeTypeParams}` : "";
|
||||
return appPath({ tenantSlug: appData.currentTenant.slug, path: `search?q=${encodeURIComponent(trimmedQuery)}${suffix}`, mode: "host-aware" });
|
||||
}, [activeTypeParams, appData?.currentTenant?.slug, trimmedQuery]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || !canUseGlobalSearch || !appData?.currentTenant?.slug) return;
|
||||
if (trimmedQuery.length < 2) {
|
||||
searchFetcher.load(appPath({ tenantSlug: appData.currentTenant.slug, path: "search/api?limit=6", mode: "host-aware" }));
|
||||
return;
|
||||
}
|
||||
const typeSuffix = activeTypeParams ? `&${activeTypeParams}` : "";
|
||||
const timeout = window.setTimeout(() => {
|
||||
searchFetcher.load(appPath({ tenantSlug: appData.currentTenant.slug, path: `search/api?q=${encodeURIComponent(trimmedQuery)}&limit=6${typeSuffix}`, mode: "host-aware" }));
|
||||
}, 300);
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, [activeTypeParams, appData?.currentTenant?.slug, canUseGlobalSearch, open, searchFetcher, trimmedQuery]);
|
||||
|
||||
const resolvedActions =
|
||||
actions ??
|
||||
@@ -60,9 +91,92 @@ export default function CommandPaletteDialog({
|
||||
}
|
||||
}}
|
||||
>
|
||||
<CommandInput data-ui-id={UI_SURFACE_IDS.commandPaletteSearch} />
|
||||
<CommandInput data-ui-id={UI_SURFACE_IDS.commandPaletteSearch} value={query} onValueChange={setQuery} />
|
||||
<CommandList data-ui-id={UI_SURFACE_IDS.commandPaletteResults}>
|
||||
<CommandEmpty>{t("app.commands.empty.title")}</CommandEmpty>
|
||||
{canUseGlobalSearch ? (
|
||||
<div className="flex flex-wrap gap-1.5 border-b border-border-neutral px-2 py-2">
|
||||
{globalSearchEntityTypes.map((type) => {
|
||||
const active = selectedEntityTypes.includes(type);
|
||||
return (
|
||||
<button
|
||||
key={type}
|
||||
type="button"
|
||||
aria-pressed={active}
|
||||
className={
|
||||
active
|
||||
? "rounded-md bg-neutral-900 px-2 py-1 text-xs font-medium text-white"
|
||||
: "text-text-neutral-secondary rounded-md border border-border-neutral px-2 py-1 text-xs font-medium hover:bg-neutral-50"
|
||||
}
|
||||
onMouseDown={(event) => event.preventDefault()}
|
||||
onClick={() => {
|
||||
setSelectedEntityTypes((current) => {
|
||||
if (current.includes(type)) {
|
||||
const next = current.filter((entry) => entry !== type);
|
||||
return next.length > 0 ? next : current;
|
||||
}
|
||||
return [...current, type];
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t(`search.entities.${type}`)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : null}
|
||||
{canUseGlobalSearch && searchResults.length > 0 ? (
|
||||
<CommandGroup heading={t("search.command.group")}>
|
||||
{searchResults.map((result) => (
|
||||
<CommandItem
|
||||
key={`${result.entityType}:${result.id}`}
|
||||
data-ui-id={UI_SURFACE_IDS.commandPaletteRow}
|
||||
value={[result.title, result.subtitle, result.entityType].filter(Boolean).join(" ")}
|
||||
onSelect={() => {
|
||||
navigate(result.href);
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
<div className="flex w-full items-center justify-between gap-2">
|
||||
<div className="min-w-0">
|
||||
<div className="text-text-neutral-primary/80 truncate text-sm font-medium">{highlightMatch(result.title, trimmedQuery)}</div>
|
||||
<div className="text-text-neutral-tertiary truncate text-xs">{highlightMatch(result.subtitle, trimmedQuery)}</div>
|
||||
</div>
|
||||
<div className="text-text-neutral-tertiary shrink-0 text-xs">{t(`search.entities.${result.entityType}`)}</div>
|
||||
</div>
|
||||
</CommandItem>
|
||||
))}
|
||||
<CommandItem
|
||||
data-ui-id={UI_SURFACE_IDS.commandPaletteRow}
|
||||
value={`${t("search.command.allResults")} ${query}`}
|
||||
onSelect={() => {
|
||||
navigate(allResultsHref);
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
<div className="text-text-neutral-primary/80 text-sm font-medium">{t("search.command.allResults", { count: searchResults.length })}</div>
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
) : null}
|
||||
{canUseGlobalSearch && trimmedQuery.length < 2 && recentSearches.length > 0 ? (
|
||||
<CommandGroup heading={t("search.command.recent")}>
|
||||
{recentSearches.map((recent) => (
|
||||
<CommandItem
|
||||
key={recent.id}
|
||||
data-ui-id={UI_SURFACE_IDS.commandPaletteRow}
|
||||
value={recent.queryText}
|
||||
onSelect={() => {
|
||||
setQuery(recent.queryText);
|
||||
}}
|
||||
>
|
||||
<div className="flex w-full items-center justify-between gap-2">
|
||||
<span className="text-text-neutral-primary/80 truncate text-sm font-medium">{recent.queryText}</span>
|
||||
<span className="text-text-neutral-tertiary shrink-0 text-xs">{t("search.results.title", { count: recent.resultCount })}</span>
|
||||
</div>
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
) : null}
|
||||
<CommandGroup>
|
||||
{resolvedActions.map((action) => (
|
||||
<CommandItem
|
||||
@@ -86,3 +200,19 @@ export default function CommandPaletteDialog({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function highlightMatch(value: string, query: string) {
|
||||
if (!query) return value;
|
||||
const index = value.toLocaleLowerCase().indexOf(query.toLocaleLowerCase());
|
||||
if (index < 0) return value;
|
||||
const before = value.slice(0, index);
|
||||
const match = value.slice(index, index + query.length);
|
||||
const after = value.slice(index + query.length);
|
||||
return (
|
||||
<>
|
||||
{before}
|
||||
<mark className="rounded bg-yellow-100 px-0.5 text-inherit">{match}</mark>
|
||||
{after}
|
||||
</>
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import "@testing-library/jest-dom";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createHotSwapDrillPage } from "@toolctrl/ui-mock";
|
||||
import { createHotSwapDrillPage } from "@hivegrid/ui-mock";
|
||||
import { HotSwapPageRenderer } from "./HotSwapPageRenderer";
|
||||
|
||||
describe("HotSwapPageRenderer", () => {
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import type { ReactElement } from "react";
|
||||
import { createShellRegistries } from "@toolctrl/ui-app";
|
||||
import type { HotSwapDrillData, MockPage } from "@toolctrl/ui-mock";
|
||||
import { createShellRegistries } from "@hivegrid/ui-app";
|
||||
import type { HotSwapDrillData, MockPage } from "@hivegrid/ui-mock";
|
||||
|
||||
export type HotSwapPageRendererProps = {
|
||||
readonly descriptor: MockPage<HotSwapDrillData>;
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
import { FeatherCreditCard } from "@subframe/core"
|
||||
|
||||
import { featherIcon } from "./_feather"
|
||||
|
||||
export default featherIcon(FeatherCreditCard)
|
||||
+10
-5
@@ -109,9 +109,9 @@ const InputDate = (
|
||||
}, [actualValue]);
|
||||
|
||||
return (
|
||||
<div className={clsx(className, !darkMode && "")}>
|
||||
<label htmlFor={name} className="flex justify-between space-x-2 text-xs font-medium">
|
||||
<div className=" flex items-center space-x-1">
|
||||
<div className={clsx("flex flex-col gap-1.5", className, !darkMode && "")}>
|
||||
<label htmlFor={name} className="flex min-h-[22px] justify-between gap-2 text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary">
|
||||
<div className="flex min-w-0 items-center gap-1">
|
||||
<div className="truncate">
|
||||
{title}
|
||||
{required && <span className="ml-1 text-red-600">*</span>}
|
||||
@@ -121,7 +121,7 @@ const InputDate = (
|
||||
</div>
|
||||
{hint}
|
||||
</label>
|
||||
<div className="relative mt-1 flex w-full rounded-md">
|
||||
<div className="relative mt-2.5 flex w-full rounded-md">
|
||||
{icon && (
|
||||
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
||||
<EntityIcon className="h-5 w-5" icon={icon} />
|
||||
@@ -144,7 +144,12 @@ const InputDate = (
|
||||
disabled={disabled || readOnly}
|
||||
readOnly={readOnly}
|
||||
autoFocus={autoFocus}
|
||||
className={cn((disabled || readOnly) && "bg-secondary/90 cursor-not-allowed", icon && "pl-10", classNameInput)}
|
||||
className={cn(
|
||||
"h-9 rounded-sm border-border-strong bg-surface-neutral-primary px-3 !text-[16px] !leading-[22px] font-body-default-regular-0 text-text-neutral-secondary shadow-none placeholder:text-text-neutral-subtle focus-visible:ring-0 focus-visible:shadow-focus md:!text-[16px]",
|
||||
(disabled || readOnly) && "cursor-not-allowed border-border-disabled bg-surface-neutral-disabled text-text-neutral-disabled",
|
||||
icon && "pl-10",
|
||||
classNameInput
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{display === "calendar" && (
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ export default function InputFilters({ filters, withSearch = true, size = "defau
|
||||
<Fragment>
|
||||
<Popover open={opened} onOpenChange={setOpened}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button type="button" aria-label={t("shared.filters")} size={size} onClick={() => setOpened(!opened)} variant="outline" className="relative z-0 inline-flex gap-2">
|
||||
<Button type="button" aria-label={t("shared.filters")} size={size} onClick={() => setOpened(!opened)} variant="outline" className="relative z-0 inline-flex shrink-0 gap-2">
|
||||
<div className={clsx("relative inline-flex items-center gap-2", filteredItems === 0 ? "rounded-md" : "rounded-l-md")}>
|
||||
<div>
|
||||
{filteredItems === 0 && <FilterEmptyIcon className="h-3 w-3" />}
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
import type { RowMedia } from "@toolctrl/db/prisma-browser";
|
||||
import clsx from "clsx";
|
||||
import { lazy, type ReactNode, Suspense, useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -15,7 +14,7 @@ const PreviewMediaModal = lazy(() => import("~/components/ui/media/PreviewMediaM
|
||||
interface Props {
|
||||
name: string;
|
||||
title?: string;
|
||||
initialMedia?: RowMedia[] | MediaDto[] | undefined;
|
||||
initialMedia?: MediaDto[] | undefined;
|
||||
disabled?: boolean;
|
||||
onSelected?: (item: MediaDto[]) => void;
|
||||
className?: string;
|
||||
|
||||
+6
-23
@@ -1,11 +1,9 @@
|
||||
import { Link, useLocation } from "react-router";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherSidebarClose, FeatherSidebarOpen } from "@subframe/core";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import Tabs from "../tabs/Tabs";
|
||||
import EntityIcon from "~/components/layouts/icons/EntityIcon";
|
||||
import { IconButton, SidebarInside } from "~/ui";
|
||||
import { SidebarInside } from "~/ui";
|
||||
|
||||
export type IconDto = {
|
||||
name: string;
|
||||
@@ -35,7 +33,6 @@ export default function SidebarIconsLayout({
|
||||
};
|
||||
scrollRestoration?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const mainElement = useRef<HTMLDivElement>(null);
|
||||
// SSR-safe: Server rendert immer aufgeklappt, der gemerkte Zustand wird erst nach Hydration geladen.
|
||||
@@ -84,9 +81,7 @@ export default function SidebarIconsLayout({
|
||||
) : (
|
||||
item.icon
|
||||
);
|
||||
// Eingeklappt: Davids zentrierte icon-only-Variant (Icon mittig, Text aus, Selected-Bg als sauberes
|
||||
// Quadrat). Der Link zentriert das w-auto-Item in der schmalen Rail (justify-center), sonst klebt das
|
||||
// Icon links. Aufgeklappt: icon-and-text, w-full -> linksbündig wie gehabt. Die Width bleibt animiert.
|
||||
// Collapsed: center the icon-only item in the narrow rail. Expanded: keep the regular label row.
|
||||
return (
|
||||
<Link key={idx} prefetch={item.prefetch} to={item.href} className="flex w-full justify-center" title={item.name}>
|
||||
<SidebarInside.NavItem icon={iconNode} selected={current} variant={collapsed ? "icon-only" : "icon-and-text"}>
|
||||
@@ -101,14 +96,13 @@ export default function SidebarIconsLayout({
|
||||
|
||||
return (
|
||||
<div className="sm:flex sm:flex-row">
|
||||
{/* Desktop: Inner-Sidebar in Davids Optik, echt einklappbar (Width-Transition) */}
|
||||
{/* Desktop: Inner sidebar uses the same mechanical width-collapse as the main navigation. */}
|
||||
<div className="relative hidden sm:flex">
|
||||
<SidebarInside
|
||||
visible={true}
|
||||
variant="open"
|
||||
className={`min-h-[calc(100vh-70px)] min-w-0 overflow-hidden ${animate ? "transition-[width] duration-200 ease-in-out" : ""} ${
|
||||
collapsed ? "w-12" : "w-[208px]"
|
||||
}`}
|
||||
variant={collapsed ? "closed" : "open"}
|
||||
onToggleCollapse={toggleCollapsed}
|
||||
className={`min-h-[calc(100svh-4rem)] ${animate ? "" : "transition-none"}`}
|
||||
>
|
||||
{topItems.map(renderItem)}
|
||||
{bottomItems.length > 0 && (
|
||||
@@ -118,17 +112,6 @@ export default function SidebarIconsLayout({
|
||||
</div>
|
||||
)}
|
||||
</SidebarInside>
|
||||
{/* Eigener sichtbarer Toggle: Davids interner Button wird vom overflow-hidden der Bar verdeckt. */}
|
||||
<div className="absolute -right-[17px] top-[26px] z-20 flex h-8 w-8 items-center justify-center">
|
||||
<IconButton
|
||||
variant="tertiary"
|
||||
size="extra-small"
|
||||
square={true}
|
||||
icon={collapsed ? <FeatherSidebarOpen /> : <FeatherSidebarClose />}
|
||||
onClick={toggleCollapsed}
|
||||
aria-label={t("components.sidebar.toggle")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Mobile: Tabs-Leiste (unverändert) */}
|
||||
|
||||
+2
-2
@@ -88,11 +88,11 @@ function KanbanColumnCard<T>({ idx, columns, column, items, withTitle }: KanbanC
|
||||
|
||||
{column?.onNewRoute && (
|
||||
<Link
|
||||
className="border-border-default text-text-neutral-tertiary hover:bg-surface-neutral-primary hover:text-text-neutral-primary/80 flex w-full items-center justify-center space-x-2 rounded-md border p-2 text-center text-xs font-medium"
|
||||
className="border-border-default text-text-neutral-tertiary hover:bg-surface-neutral-primary hover:text-text-neutral-primary/80 flex w-full items-center justify-center gap-2 rounded-md border p-2 text-center text-xs font-medium"
|
||||
to={column.onNewRoute(column.name)}
|
||||
>
|
||||
<div>{t("shared.add")}</div>
|
||||
<PlusIcon className="h-3 w-3" />
|
||||
<PlusIcon className="h-3 w-3 shrink-0" />
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -119,11 +119,11 @@ function KanbanColumnCard<T>({ idx, columns, column, items, classNameWidth }: Ka
|
||||
|
||||
{column?.onNewRoute && (
|
||||
<Link
|
||||
className="border-border-default text-text-neutral-tertiary hover:bg-surface-neutral-primary hover:text-text-neutral-primary/80 flex w-full items-center justify-center space-x-2 rounded-md border p-2 text-center text-xs font-medium"
|
||||
className="border-border-default text-text-neutral-tertiary hover:bg-surface-neutral-primary hover:text-text-neutral-primary/80 flex w-full items-center justify-center gap-2 rounded-md border p-2 text-center text-xs font-medium"
|
||||
to={column.onNewRoute(column.name)}
|
||||
>
|
||||
<div>{t("shared.add")}</div>
|
||||
<PlusIcon className="h-3 w-3" />
|
||||
<PlusIcon className="h-3 w-3 shrink-0" />
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import "@testing-library/jest-dom";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
import ViewToggle from "./ViewToggle";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { expectNoAxeViolations } from "@toolctrl/ui-app/test-setup/axe";
|
||||
import { expectNoAxeViolations } from "@hivegrid/ui-app/test-setup/axe";
|
||||
import ViewToggleWithUrl from "./ViewToggleWithUrl";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
import { Link, useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { subscriptionRequiredCheckoutPath } from "~/utils/app/SubscriptionUrlUtils";
|
||||
import { appPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
|
||||
export default function ProFeature() {
|
||||
const { t } = useTranslation();
|
||||
const params = useParams();
|
||||
const to = params.tenant ? subscriptionRequiredCheckoutPath(params.tenant) : "/login";
|
||||
const to = params.tenant ? appPath({ tenantSlug: params.tenant, path: "settings/subscription", mode: "host-aware" }) : "/login";
|
||||
|
||||
return (
|
||||
<div className="border-border-default bg-surface-neutral-primary text-text-neutral-primary rounded-md border-2 border-dashed py-6 text-center font-medium">
|
||||
|
||||
+12
-4
@@ -6,14 +6,22 @@ interface Props {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
size?: "xs" | "sm" | "md" | "lg";
|
||||
tone?: "default" | "danger";
|
||||
}
|
||||
export default function SettingSection({
|
||||
title,
|
||||
description,
|
||||
children,
|
||||
className = "border border-border-default dark:border-border-default/50 shadow-2xs px-4 py-5 bg-surface-neutral-primary sm:p-6 rounded-md",
|
||||
className,
|
||||
size = "md",
|
||||
tone = "default",
|
||||
}: Props) {
|
||||
const cardClassName =
|
||||
className ??
|
||||
(tone === "danger"
|
||||
? "border border-red-200 shadow-2xs px-4 py-5 bg-red-50 sm:p-6 rounded-md"
|
||||
: "border border-border-default dark:border-border-default/50 shadow-2xs px-4 py-5 bg-surface-neutral-primary sm:p-6 rounded-md");
|
||||
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
@@ -25,14 +33,14 @@ export default function SettingSection({
|
||||
>
|
||||
<div className={clsx(size === "sm" && "md:col-span-1", size === "md" && "md:col-span-1", size === "lg" && "md:col-span-1")}>
|
||||
<div className="sm:px-0">
|
||||
<h3 className="text-text-neutral-primary text-lg font-medium leading-6">{title}</h3>
|
||||
<div className="text-text-neutral-tertiary mt-1 text-sm leading-5">{description}</div>
|
||||
<h3 className={clsx("text-lg font-medium leading-6", tone === "danger" ? "text-red-700" : "text-text-neutral-primary")}>{title}</h3>
|
||||
<div className={clsx("mt-1 text-sm leading-5", tone === "danger" ? "text-red-600" : "text-text-neutral-tertiary")}>{description}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={clsx("mt-5 md:mt-0", size === "sm" && "md:col-span-1", size === "md" && "md:col-span-2", size === "lg" && "md:col-span-3")}>
|
||||
<div>
|
||||
<div className="sm:rounded-sm">
|
||||
<div className={className}>{children}</div>
|
||||
<div className={cardClassName}>{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
import { useSearchParams } from "react-router";
|
||||
import { Fragment } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Constants from "~/application/Constants";
|
||||
import type { PaginationDto } from "~/application/dtos/data/PaginationDto";
|
||||
import type { EntityViewWithDetails } from "~/utils/db/entities/entityViews.db.server";
|
||||
|
||||
export default function RowsLoadMoreCard({
|
||||
pagination,
|
||||
currentView,
|
||||
className,
|
||||
}: {
|
||||
pagination?: PaginationDto;
|
||||
currentView?: EntityViewWithDetails | null;
|
||||
className?: string;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
function theresMore() {
|
||||
if (!pagination) {
|
||||
return false;
|
||||
}
|
||||
return pagination.totalItems > pagination.page * pagination.pageSize;
|
||||
}
|
||||
return (
|
||||
<Fragment>
|
||||
{theresMore() && (
|
||||
<div className={className}>
|
||||
<button
|
||||
type="button"
|
||||
className="border-border-default hover:border-border-default group inline-block h-full w-full truncate rounded-md border-2 border-dashed p-4 text-left align-middle shadow-2xs hover:border-dotted hover:bg-surface-neutral-secondary"
|
||||
onClick={() => {
|
||||
if (!pagination) {
|
||||
return;
|
||||
}
|
||||
let currentPageSize = 0;
|
||||
const paramsPageSize = searchParams.get("pageSize") ? parseInt(searchParams.get("pageSize") ?? "") : undefined;
|
||||
if (paramsPageSize) {
|
||||
currentPageSize = paramsPageSize;
|
||||
} else {
|
||||
currentPageSize = pagination.pageSize;
|
||||
}
|
||||
let currentViewPageSize = currentView ? currentView.pageSize : 0;
|
||||
if (currentViewPageSize === 0) {
|
||||
currentViewPageSize = Constants.DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
const pageSize = currentPageSize + currentViewPageSize;
|
||||
searchParams.set("pageSize", pageSize.toString());
|
||||
setSearchParams(searchParams);
|
||||
}}
|
||||
>
|
||||
<div className="text-text-neutral-secondary mx-auto flex justify-center text-center align-middle text-sm font-medium">{t("shared.loadMore")}</div>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user