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
+5
-5
@@ -2,8 +2,8 @@ import { useTranslation } from "react-i18next";
|
||||
import { useAppData } from "~/utils/data/useAppData";
|
||||
import { Link, useParams } from "react-router";
|
||||
import clsx from "~/utils/shared/ClassesUtils";
|
||||
import { subscriptionCheckoutPath } from "~/utils/app/SubscriptionUrlUtils";
|
||||
import { SparklesIcon } from "~/components/ui/icons/vendor";
|
||||
import { appPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import { CreditCard } from "~/components/ui/icons/vendor";
|
||||
|
||||
export default function CurrentSubscriptionButton() {
|
||||
const params = useParams();
|
||||
@@ -22,7 +22,7 @@ export default function CurrentSubscriptionButton() {
|
||||
<div className="hidden divide-x divide-gray-300 rounded-sm shadow-none lg:inline-flex">
|
||||
<div className="relative z-0 inline-flex rounded-full text-xs shadow-none sm:text-sm">
|
||||
<Link
|
||||
to={!params.tenant ? "" : subscriptionCheckoutPath(params.tenant)}
|
||||
to={!params.tenant ? "" : appPath({ tenantSlug: params.tenant, path: "settings/subscription", mode: "host-aware" })}
|
||||
className={clsx(
|
||||
"text-muted-foreground bg-secondary border-border relative inline-flex items-center space-x-1 rounded-md border p-2 font-medium shadow-inner hover:bg-teal-50 hover:text-teal-800 focus:z-10 focus:bg-teal-100 focus:text-teal-900 focus:outline-hidden",
|
||||
hasSubscription() &&
|
||||
@@ -40,10 +40,10 @@ export default function CurrentSubscriptionButton() {
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<span>{t("pricing.subscribe")} </span>
|
||||
<span>{t("app.navbar.subscription")} </span>
|
||||
</div>
|
||||
)}
|
||||
<SparklesIcon className="h-4 w-4" />
|
||||
<CreditCard className="h-4 w-4" />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+42
-42
@@ -6,55 +6,55 @@ import { BellIcon } from "~/components/ui/icons/vendor";
|
||||
interface Props {
|
||||
unseenCount?: number;
|
||||
to: string;
|
||||
/**
|
||||
* AK-P3 (AD-28): when provided the bell opens the notifications drawer
|
||||
* instead of navigating; the tenant NavBar wires this together with the
|
||||
* live SSE unseen count. Hosts without a drawer (admin) keep the link.
|
||||
*/
|
||||
onOpen?: () => void;
|
||||
}
|
||||
export default function NotificationsButton({ unseenCount, to }: Props) {
|
||||
|
||||
export default function NotificationsButton({ unseenCount, to, onOpen }: Props) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const className = clsx(
|
||||
"text-muted-foreground bg-secondary hover:bg-secondary/90 border-border relative inline-flex items-center rounded-full border p-2 font-medium shadow-inner focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
||||
);
|
||||
|
||||
const content = (
|
||||
<>
|
||||
<span className="relative inline-block h-5 w-5 overflow-hidden rounded-full">
|
||||
<BellIcon className="h-5 w-5" />
|
||||
</span>
|
||||
{typeof unseenCount === "number" && unseenCount > 0 && (
|
||||
<span className="absolute inset-0 -mr-6 object-right-top" data-ui-id="ui.notifications.bell.count">
|
||||
<div className="inline-flex items-center rounded-full border-2 border-white bg-red-500 px-1.5 py-0.5 text-xs font-semibold leading-4 text-white">
|
||||
{unseenCount}
|
||||
</div>
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<div className="inline-flex divide-x divide-gray-300 rounded-sm shadow-none">
|
||||
<a
|
||||
href={to}
|
||||
data-ui-id={UI_ACTION_IDS.notifications}
|
||||
aria-label={t("shell.notifications.ariaLabel")}
|
||||
className={clsx(
|
||||
"text-muted-foreground bg-secondary hover:bg-secondary/90 border-border relative inline-flex items-center rounded-full border p-2 font-medium shadow-inner focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
||||
)}
|
||||
>
|
||||
<span className="relative inline-block h-5 w-5 overflow-hidden rounded-full">
|
||||
<BellIcon className="h-5 w-5" />
|
||||
</span>
|
||||
{unseenCount?.toString() !== "0" && (
|
||||
<span className="absolute inset-0 -mr-6 object-right-top">
|
||||
<div className="inline-flex items-center rounded-full border-2 border-white bg-red-500 px-1.5 py-0.5 text-xs font-semibold leading-4 text-white">
|
||||
{unseenCount}
|
||||
</div>
|
||||
</span>
|
||||
)}
|
||||
</a>
|
||||
{onOpen ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpen}
|
||||
data-ui-id={UI_ACTION_IDS.notifications}
|
||||
aria-label={t("shell.notifications.ariaLabel")}
|
||||
className={className}
|
||||
>
|
||||
{content}
|
||||
</button>
|
||||
) : (
|
||||
<a href={to} data-ui-id={UI_ACTION_IDS.notifications} aria-label={t("shell.notifications.ariaLabel")} className={className}>
|
||||
{content}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
// <div className="w-full flex md:ml-0">
|
||||
// <div className="align-baseline w-full text-slate-200 pl-1">
|
||||
// <div className="w-full">
|
||||
// <label htmlFor="command-palette" className="sr-only">
|
||||
// {t("shared.commandPalette")}
|
||||
// </label>
|
||||
// <div className="relative text-muted-foreground hover:text-muted-foreground truncate">
|
||||
|
||||
// <button
|
||||
// type="button"
|
||||
// onClick={onOpenCommandPalette}
|
||||
// className="flex space-x-2 text-left w-full pl-3 pr-3 py-1.5 text-sm sm:py-2 border border-border rounded-md leading-5 bg-secondary text-muted-foreground focus:outline-hidden hover:ring-0 hover:placeholder-gray-500 hover:text-muted-foreground truncate"
|
||||
// >
|
||||
// <div className="font-medium hidden lg:block">⌘K</div>
|
||||
// <div className="hidden lg:block truncate">{t("shared.commandPalette")}</div>
|
||||
// <div className="lg:hidden">{t("shared.search")}</div>
|
||||
// </button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { quickActionEntityPath } from "./QuickActionsButton";
|
||||
|
||||
describe("quickActionEntityPath", () => {
|
||||
it("keeps create links inside the active group route", () => {
|
||||
expect(quickActionEntityPath({ tenant: "acme", group: "sales" }, "contacts")).toBe("/acme/g/sales/contacts/new");
|
||||
});
|
||||
|
||||
it("uses the tenant entity route outside groups", () => {
|
||||
expect(quickActionEntityPath({ tenant: "acme" }, "contacts")).toBe("/acme/contacts/new");
|
||||
});
|
||||
});
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
import { Link, useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Transition } from "@headlessui/react";
|
||||
import { Fragment, useState } from "react";
|
||||
import { useOuterClick } from "~/utils/shared/KeypressUtils";
|
||||
import { useAppData } from "~/utils/data/useAppData";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { EntitySimple } from "~/utils/db/entities/entities.db.server";
|
||||
import { getEntityPermission, getUserHasPermission } from "~/utils/helpers/PermissionsHelper";
|
||||
import { PlusIcon } from "~/components/ui/icons/vendor";
|
||||
|
||||
interface Props {
|
||||
entities: EntitySimple[];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function quickActionEntityPath(params: { tenant?: string; group?: string }, entitySlug: string) {
|
||||
const path = params.group ? `g/${params.group}/${entitySlug}/new` : `${entitySlug}/new`;
|
||||
return UrlUtils.currentTenantUrl(params, path);
|
||||
}
|
||||
|
||||
export default function QuickActionsButton({ entities, className }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const params = useParams();
|
||||
const appData = useAppData();
|
||||
|
||||
const [opened, setOpened] = useState(false);
|
||||
const creatableEntities = entities.filter((entity) => getUserHasPermission(appData, getEntityPermission(entity, "create")));
|
||||
const hasQuickActions = creatableEntities.length > 0;
|
||||
|
||||
const clickOutside = useOuterClick(() => setOpened(false));
|
||||
return (
|
||||
<span className={className} ref={clickOutside}>
|
||||
{hasQuickActions && (
|
||||
<div className="relative">
|
||||
<div className="inline-flex divide-x divide-gray-300 rounded-sm shadow-none">
|
||||
<div className="relative z-0 inline-flex rounded-full text-sm shadow-none">
|
||||
<button
|
||||
onClick={() => setOpened(!opened)}
|
||||
type="button"
|
||||
className="text-muted-foreground bg-secondary hover:bg-secondary/90 border-border relative inline-flex items-center rounded-full border p-2 font-medium shadow-inner focus:z-10 focus:outline-hidden focus:ring-2 focus:ring-offset-2"
|
||||
aria-haspopup="listbox"
|
||||
aria-expanded="true"
|
||||
aria-label={t("shared.new")}
|
||||
>
|
||||
<span className="sr-only">{t("shared.new")}</span>
|
||||
<PlusIcon className="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
show={opened}
|
||||
enter="transition ease-out duration-100"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95"
|
||||
>
|
||||
<ul
|
||||
className="divide-border bg-background absolute right-0 z-40 mt-2 w-72 origin-top-right divide-y overflow-hidden rounded-sm shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden"
|
||||
tabIndex={-1}
|
||||
aria-labelledby="listbox-label"
|
||||
>
|
||||
{creatableEntities.map((entity) => {
|
||||
return (
|
||||
<li key={entity.name} className="text-foreground relative cursor-default select-none text-sm" id="listbox-option-0">
|
||||
<Link
|
||||
to={quickActionEntityPath(params, entity.slug)}
|
||||
onClick={() => setOpened(false)}
|
||||
className="hover:bg-secondary flex flex-col p-4"
|
||||
>
|
||||
<div className="flex justify-between">
|
||||
<p className="font-semibold">
|
||||
{t("shared.new")} {t(entity.title)}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Transition>
|
||||
</div>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user