@greatapps/common 1.1.418 → 1.1.420
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +4 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/components/navigation/NavItem.mjs +6 -4
- package/dist/components/navigation/NavItem.mjs.map +1 -1
- package/dist/components/navigation/shells/TabsMobileShell.mjs +4 -2
- package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/NavItems.mjs +2 -2
- package/dist/components/navigation/subcomponents/NavItems.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/navigation/CancelledSubscriptionBanner.tsx +5 -1
- package/src/components/navigation/NavItem.tsx +8 -6
- package/src/components/navigation/shells/TabsMobileShell.tsx +6 -4
- package/src/components/navigation/subcomponents/NavItems.tsx +3 -2
|
@@ -17,7 +17,10 @@ function CancelledSubscriptionBanner({ onReactivate }) {
|
|
|
17
17
|
const today = /* @__PURE__ */ new Date();
|
|
18
18
|
const isPastDue = today >= dueDate;
|
|
19
19
|
const formattedDate = formatShortDate(dueDate);
|
|
20
|
-
|
|
20
|
+
const isTrial = subscription?.type === "trial";
|
|
21
|
+
if (!visible) return null;
|
|
22
|
+
if (isTrial && !isPastDue) return null;
|
|
23
|
+
if (!isTrial && (!subscription?.date_cancellation || isPastDue)) return null;
|
|
21
24
|
return /* @__PURE__ */ jsx("div", { className: "fixed top-[80px] md:top-0 lg:left-[273px] left-0 right-0 z-[60] flex justify-center pointer-events-none px-4 lg:px-0", children: /* @__PURE__ */ jsxs(
|
|
22
25
|
"div",
|
|
23
26
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/navigation/CancelledSubscriptionBanner.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { IconAlertOctagon, IconX } from '@tabler/icons-react';\nimport { formatShortDate } from '../../infra/utils/date';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\n\ninterface CancelledSubscriptionBannerProps {\n onReactivate?: () => void;\n}\n\nexport function CancelledSubscriptionBanner({ onReactivate }: CancelledSubscriptionBannerProps) {\n const { data: { data: [subscription] = [] } = {} } = useActiveSubscription();\n const [visible, setVisible] = useState(true);\n const [animated, setAnimated] = useState(false);\n\n useEffect(() => {\n const timer = setTimeout(() => setAnimated(true), 50);\n return () => clearTimeout(timer);\n }, []);\n\n const dismiss = useCallback(() => setVisible(false), []);\n const dueDate = new Date(subscription?.date_due);\n const today = new Date();\n const isPastDue = today >= dueDate;\n const formattedDate = formatShortDate(dueDate);\n\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/navigation/CancelledSubscriptionBanner.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { IconAlertOctagon, IconX } from '@tabler/icons-react';\nimport { formatShortDate } from '../../infra/utils/date';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\n\ninterface CancelledSubscriptionBannerProps {\n onReactivate?: () => void;\n}\n\nexport function CancelledSubscriptionBanner({ onReactivate }: CancelledSubscriptionBannerProps) {\n const { data: { data: [subscription] = [] } = {} } = useActiveSubscription();\n const [visible, setVisible] = useState(true);\n const [animated, setAnimated] = useState(false);\n\n useEffect(() => {\n const timer = setTimeout(() => setAnimated(true), 50);\n return () => clearTimeout(timer);\n }, []);\n\n const dismiss = useCallback(() => setVisible(false), []);\n const dueDate = new Date(subscription?.date_due);\n const today = new Date();\n const isPastDue = today >= dueDate;\n const formattedDate = formatShortDate(dueDate);\n\n const isTrial = subscription?.type === 'trial';\n\n if (!visible) return null;\n if (isTrial && !isPastDue) return null;\n if (!isTrial && (!subscription?.date_cancellation || isPastDue)) return null;\n\n return (\n <div className=\"fixed top-[80px] md:top-0 lg:left-[273px] left-0 right-0 z-[60] flex justify-center pointer-events-none px-4 lg:px-0\">\n <div\n className={`flex flex-col sm:flex-row items-start sm:items-center justify-between bg-red-500 rounded-lg px-3 py-2 sm:py-1 w-full lg:w-[805px] max-w-full pointer-events-auto transition-transform duration-500 ease-out gap-2 sm:gap-0 ${animated ? 'translate-y-0 md:translate-y-9' : '-translate-y-full'}`}\n >\n <div className=\"flex items-center gap-2 flex-1 w-full sm:w-auto\">\n <IconAlertOctagon size={16} className=\"text-white shrink-0\" />\n <span className=\"paragraph-xsmall-semibold text-white\">\n {isPastDue\n ? 'Sua assinatura foi cancelada e suas páginas foram retiradas do ar.'\n : `Assinatura cancelada! Suas páginas serão retiradas do ar no dia ${formattedDate}!`}\n </span>\n </div>\n <div className=\"flex items-center gap-1.5 w-full sm:w-auto justify-between sm:justify-start\">\n <button\n type=\"button\"\n className=\"flex items-center justify-center p-1.5 cursor-pointer\"\n onClick={onReactivate}\n >\n <span className=\"paragraph-xsmall-semibold text-white underline\">\n Reativar assinatura\n </span>\n </button>\n <button type=\"button\" className=\"cursor-pointer shrink-0\" onClick={dismiss}>\n <IconX size={18} className=\"text-red-200\" />\n </button>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";AAsCQ,SACE,KADF;AApCR,SAAS,UAAU,WAAW,mBAAmB;AACjD,SAAS,kBAAkB,aAAa;AACxC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAM/B,SAAS,4BAA4B,EAAE,aAAa,GAAqC;AAC9F,QAAM,EAAE,MAAM,EAAE,MAAM,CAAC,YAAY,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,sBAAsB;AAC3E,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,IAAI;AAC3C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,YAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM,YAAY,IAAI,GAAG,EAAE;AACpD,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,YAAY,MAAM,WAAW,KAAK,GAAG,CAAC,CAAC;AACvD,QAAM,UAAU,IAAI,KAAK,cAAc,QAAQ;AAC/C,QAAM,QAAQ,oBAAI,KAAK;AACvB,QAAM,YAAY,SAAS;AAC3B,QAAM,gBAAgB,gBAAgB,OAAO;AAE7C,QAAM,UAAU,cAAc,SAAS;AAEvC,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI,WAAW,CAAC,UAAW,QAAO;AAClC,MAAI,CAAC,YAAY,CAAC,cAAc,qBAAqB,WAAY,QAAO;AAExE,SACE,oBAAC,SAAI,WAAU,wHACb;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,8NAA8N,WAAW,mCAAmC,mBAAmB;AAAA,MAE1S;AAAA,6BAAC,SAAI,WAAU,mDACb;AAAA,8BAAC,oBAAiB,MAAM,IAAI,WAAU,uBAAsB;AAAA,UAC5D,oBAAC,UAAK,WAAU,wCACb,sBACG,0EACA,yEAAmE,aAAa,KACtF;AAAA,WACF;AAAA,QACA,qBAAC,SAAI,WAAU,+EACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,cAET,8BAAC,UAAK,WAAU,kDAAiD,iCAEjE;AAAA;AAAA,UACF;AAAA,UACA,oBAAC,YAAO,MAAK,UAAS,WAAU,2BAA0B,SAAS,SACjE,8BAAC,SAAM,MAAM,IAAI,WAAU,gBAAe,GAC5C;AAAA,WACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
3
4
|
import { useAppNavigationContext } from "./AppNavigationContext";
|
|
4
5
|
import { useMobileNavbarSheet } from "../../store/useMobileNavbarSheet";
|
|
5
6
|
import { useMdSidebarStore } from "../../store/useMdSidebarStore";
|
|
6
|
-
function NavItem({ icon: Icon, label,
|
|
7
|
+
function NavItem({ icon: Icon, label, href, isActive = false }) {
|
|
7
8
|
const { breakpoint } = useAppNavigationContext();
|
|
8
9
|
const { close } = useMobileNavbarSheet();
|
|
9
10
|
const { collapse } = useMdSidebarStore();
|
|
10
11
|
const handleClick = () => {
|
|
11
|
-
onClick();
|
|
12
12
|
if (breakpoint === "mobile") {
|
|
13
13
|
close();
|
|
14
14
|
} else if (breakpoint === "md") {
|
|
@@ -16,9 +16,11 @@ function NavItem({ icon: Icon, label, onClick, isActive = false }) {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
return /* @__PURE__ */ jsxs(
|
|
19
|
-
|
|
19
|
+
Link,
|
|
20
20
|
{
|
|
21
|
-
|
|
21
|
+
href,
|
|
22
|
+
prefetch: true,
|
|
23
|
+
className: `rounded-md flex items-center gap-2 p-3 cursor-pointer transition-colors no-underline ${isActive ? "bg-gray-50" : "bg-white hover:bg-gray-100"} active:bg-gray-50`,
|
|
22
24
|
onClick: handleClick,
|
|
23
25
|
children: [
|
|
24
26
|
Icon && /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/navigation/NavItem.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ElementType } from 'react';\r\nimport { useAppNavigationContext } from './AppNavigationContext';\r\nimport { useMobileNavbarSheet } from '../../store/useMobileNavbarSheet';\r\nimport { useMdSidebarStore } from '../../store/useMdSidebarStore';\r\n\r\ninterface NavItemProps {\r\n icon?: ElementType;\r\n label: string;\r\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/navigation/NavItem.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ElementType } from 'react';\r\nimport Link from 'next/link';\r\nimport { useAppNavigationContext } from './AppNavigationContext';\r\nimport { useMobileNavbarSheet } from '../../store/useMobileNavbarSheet';\r\nimport { useMdSidebarStore } from '../../store/useMdSidebarStore';\r\n\r\ninterface NavItemProps {\r\n icon?: ElementType;\r\n label: string;\r\n href: string;\r\n isActive?: boolean;\r\n}\r\n\r\nexport function NavItem({ icon: Icon, label, href, isActive = false }: NavItemProps) {\r\n const { breakpoint } = useAppNavigationContext();\r\n const { close } = useMobileNavbarSheet();\r\n const { collapse } = useMdSidebarStore();\r\n\r\n const handleClick = () => {\r\n if (breakpoint === 'mobile') {\r\n close();\r\n } else if (breakpoint === 'md') {\r\n collapse();\r\n }\r\n };\r\n\r\n return (\r\n <Link\r\n href={href}\r\n prefetch\r\n className={`rounded-md flex items-center gap-2 p-3 cursor-pointer transition-colors no-underline ${\r\n isActive ? 'bg-gray-50' : 'bg-white hover:bg-gray-100'\r\n } active:bg-gray-50`}\r\n onClick={handleClick}\r\n >\r\n {Icon && (\r\n <Icon\r\n size={20}\r\n className={isActive ? 'text-gray-950' : 'text-gray-400'}\r\n />\r\n )}\r\n <span className={`paragraph-small-medium ${isActive ? 'text-gray-950' : 'text-gray-500'}`}>\r\n {label}\r\n </span>\r\n </Link>\r\n );\r\n}\r\n"],"mappings":";AA6BI,SASI,KATJ;AA1BJ,OAAO,UAAU;AACjB,SAAS,+BAA+B;AACxC,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAS3B,SAAS,QAAQ,EAAE,MAAM,MAAM,OAAO,MAAM,WAAW,MAAM,GAAiB;AACnF,QAAM,EAAE,WAAW,IAAI,wBAAwB;AAC/C,QAAM,EAAE,MAAM,IAAI,qBAAqB;AACvC,QAAM,EAAE,SAAS,IAAI,kBAAkB;AAEvC,QAAM,cAAc,MAAM;AACxB,QAAI,eAAe,UAAU;AAC3B,YAAM;AAAA,IACR,WAAW,eAAe,MAAM;AAC9B,eAAS;AAAA,IACX;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,UAAQ;AAAA,MACR,WAAW,wFACT,WAAW,eAAe,4BAC5B;AAAA,MACA,SAAS;AAAA,MAER;AAAA,gBACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,WAAW,WAAW,kBAAkB;AAAA;AAAA,QAC1C;AAAA,QAEF,oBAAC,UAAK,WAAW,0BAA0B,WAAW,kBAAkB,eAAe,IACpF,iBACH;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useEffect } from "react";
|
|
4
|
+
import Link from "next/link";
|
|
4
5
|
import { AppNavigationContext } from "../AppNavigationContext";
|
|
5
6
|
import { useNavItemsContext } from "../NavItemsContext";
|
|
6
7
|
function InternalTabsBar({ topOffset = "72px" }) {
|
|
@@ -26,10 +27,11 @@ function InternalTabsBar({ topOffset = "72px" }) {
|
|
|
26
27
|
className: "md:hidden fixed left-0 right-0 z-40 bg-white border-b border-gray-200 flex overflow-x-auto scrollbar-hide",
|
|
27
28
|
style: { top: topOffset },
|
|
28
29
|
children: navItems.map((item) => /* @__PURE__ */ jsxs(
|
|
29
|
-
|
|
30
|
+
Link,
|
|
30
31
|
{
|
|
31
32
|
ref: item.isActive ? activeTabRef : void 0,
|
|
32
|
-
|
|
33
|
+
href: item.href,
|
|
34
|
+
prefetch: true,
|
|
33
35
|
className: `flex items-center gap-2 px-4 py-3 shrink-0 border-b-2 transition-colors ${item.isActive ? "border-gray-950 text-gray-950" : "border-transparent text-gray-500 hover:text-gray-900"}`,
|
|
34
36
|
children: [
|
|
35
37
|
item.icon && /* @__PURE__ */ jsx(item.icon, { size: 16, className: "shrink-0" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/navigation/shells/TabsMobileShell.tsx"],"sourcesContent":["'use client';\n\nimport { ReactNode, useRef, useEffect } from 'react';\nimport { AppNavigationContext } from '../AppNavigationContext';\nimport { useNavItemsContext } from '../NavItemsContext';\n\nfunction InternalTabsBar({ topOffset = '72px' }: { topOffset?: string }) {\n const { navItems } = useNavItemsContext();\n const tabsListRef = useRef<HTMLDivElement>(null);\n const activeTabRef = useRef<
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/navigation/shells/TabsMobileShell.tsx"],"sourcesContent":["'use client';\n\nimport { ReactNode, useRef, useEffect } from 'react';\nimport Link from 'next/link';\nimport { AppNavigationContext } from '../AppNavigationContext';\nimport { useNavItemsContext } from '../NavItemsContext';\n\nfunction InternalTabsBar({ topOffset = '72px' }: { topOffset?: string }) {\n const { navItems } = useNavItemsContext();\n const tabsListRef = useRef<HTMLDivElement>(null);\n const activeTabRef = useRef<HTMLAnchorElement>(null);\n\n const activeLabel = navItems.find((i) => i.isActive)?.label;\n\n // Scroll active tab into center when active item changes\n useEffect(() => {\n if (activeTabRef.current && tabsListRef.current) {\n const tabsList = tabsListRef.current;\n const activeTabElement = activeTabRef.current;\n const tabsListRect = tabsList.getBoundingClientRect();\n const activeTabRect = activeTabElement.getBoundingClientRect();\n const scrollLeft =\n activeTabElement.offsetLeft - tabsListRect.width / 2 + activeTabRect.width / 2;\n tabsList.scrollTo({ left: Math.max(0, scrollLeft), behavior: 'smooth' });\n }\n }, [activeLabel]);\n\n if (!navItems.length) return null;\n\n return (\n <div\n ref={tabsListRef}\n className=\"md:hidden fixed left-0 right-0 z-40 bg-white border-b border-gray-200 flex overflow-x-auto scrollbar-hide\"\n style={{ top: topOffset }}\n >\n {navItems.map((item) => (\n <Link\n key={item.label}\n ref={item.isActive ? activeTabRef : undefined}\n href={item.href}\n prefetch\n className={`flex items-center gap-2 px-4 py-3 shrink-0 border-b-2 transition-colors ${\n item.isActive\n ? 'border-gray-950 text-gray-950'\n : 'border-transparent text-gray-500 hover:text-gray-900'\n }`}\n >\n {item.icon && <item.icon size={16} className=\"shrink-0\" />}\n <span\n className={\n item.isActive ? 'paragraph-small-semibold' : 'paragraph-small-medium'\n }\n >\n {item.label}\n </span>\n </Link>\n ))}\n </div>\n );\n}\n\nexport function TabsMobileShell({ children, topOffset }: { children: ReactNode; topOffset?: string }) {\n return (\n <AppNavigationContext.Provider value={{ breakpoint: 'mobile' }}>\n {/*\n Children are hidden visually, but NavItems' useEffect still fires inside\n display:none — React effects are tied to commit phase, not layout visibility.\n This registers navItems in NavItemsContext so InternalTabsBar can read them.\n */}\n <div className=\"hidden\">{children}</div>\n <InternalTabsBar topOffset={topOffset} />\n </AppNavigationContext.Provider>\n );\n}\n"],"mappings":";AAoCQ,SAWgB,KAXhB;AAlCR,SAAoB,QAAQ,iBAAiB;AAC7C,OAAO,UAAU;AACjB,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AAEnC,SAAS,gBAAgB,EAAE,YAAY,OAAO,GAA2B;AACvE,QAAM,EAAE,SAAS,IAAI,mBAAmB;AACxC,QAAM,cAAc,OAAuB,IAAI;AAC/C,QAAM,eAAe,OAA0B,IAAI;AAEnD,QAAM,cAAc,SAAS,KAAK,CAAC,MAAM,EAAE,QAAQ,GAAG;AAGtD,YAAU,MAAM;AACd,QAAI,aAAa,WAAW,YAAY,SAAS;AAC/C,YAAM,WAAW,YAAY;AAC7B,YAAM,mBAAmB,aAAa;AACtC,YAAM,eAAe,SAAS,sBAAsB;AACpD,YAAM,gBAAgB,iBAAiB,sBAAsB;AAC7D,YAAM,aACJ,iBAAiB,aAAa,aAAa,QAAQ,IAAI,cAAc,QAAQ;AAC/E,eAAS,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,UAAU,GAAG,UAAU,SAAS,CAAC;AAAA,IACzE;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,MAAI,CAAC,SAAS,OAAQ,QAAO;AAE7B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,WAAU;AAAA,MACV,OAAO,EAAE,KAAK,UAAU;AAAA,MAEvB,mBAAS,IAAI,CAAC,SACb;AAAA,QAAC;AAAA;AAAA,UAEC,KAAK,KAAK,WAAW,eAAe;AAAA,UACpC,MAAM,KAAK;AAAA,UACX,UAAQ;AAAA,UACR,WAAW,2EACT,KAAK,WACD,kCACA,sDACN;AAAA,UAEC;AAAA,iBAAK,QAAQ,oBAAC,KAAK,MAAL,EAAU,MAAM,IAAI,WAAU,YAAW;AAAA,YACxD;AAAA,cAAC;AAAA;AAAA,gBACC,WACE,KAAK,WAAW,6BAA6B;AAAA,gBAG9C,eAAK;AAAA;AAAA,YACR;AAAA;AAAA;AAAA,QAjBK,KAAK;AAAA,MAkBZ,CACD;AAAA;AAAA,EACH;AAEJ;AAEO,SAAS,gBAAgB,EAAE,UAAU,UAAU,GAAgD;AACpG,SACE,qBAAC,qBAAqB,UAArB,EAA8B,OAAO,EAAE,YAAY,SAAS,GAM3D;AAAA,wBAAC,SAAI,WAAU,UAAU,UAAS;AAAA,IAClC,oBAAC,mBAAgB,WAAsB;AAAA,KACzC;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/navigation/subcomponents/NavItems.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ElementType, useEffect } from 'react';\r\nimport { NavItem } from '../NavItem';\r\nimport { useNavItemsContext } from '../NavItemsContext';\r\n\r\nexport interface NavItemConfig {\r\n label: string;\r\n isActive: boolean;\r\n icon: ElementType;\r\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/navigation/subcomponents/NavItems.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ElementType, useEffect } from 'react';\r\nimport { NavItem } from '../NavItem';\r\nimport { useNavItemsContext } from '../NavItemsContext';\r\nimport { useRouter } from 'next/navigation';\r\n\r\nexport interface NavItemConfig {\r\n label: string;\r\n isActive: boolean;\r\n icon: ElementType;\r\n href: string;\r\n}\r\n\r\ninterface NavItemsProps {\r\n items: NavItemConfig[];\r\n}\r\n\r\nexport function NavItems({ items }: NavItemsProps) {\r\n const { setNavItems } = useNavItemsContext();\r\n\r\n useEffect(() => {\r\n setNavItems(items);\r\n }, [items, setNavItems]);\r\n\r\n return (\r\n <div className=\"flex flex-col\">\r\n {items.map((item) => (\r\n <NavItem\r\n key={item.label}\r\n label={item.label}\r\n icon={item.icon}\r\n href={item.href}\r\n isActive={item.isActive}\r\n />\r\n ))}\r\n </div>\r\n );\r\n}\r\n"],"mappings":";AA4BQ;AA1BR,SAAsB,iBAAiB;AACvC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAc5B,SAAS,SAAS,EAAE,MAAM,GAAkB;AACjD,QAAM,EAAE,YAAY,IAAI,mBAAmB;AAE3C,YAAU,MAAM;AACd,gBAAY,KAAK;AAAA,EACnB,GAAG,CAAC,OAAO,WAAW,CAAC;AAEvB,SACE,oBAAC,SAAI,WAAU,iBACZ,gBAAM,IAAI,CAAC,SACV;AAAA,IAAC;AAAA;AAAA,MAEC,OAAO,KAAK;AAAA,MACZ,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,UAAU,KAAK;AAAA;AAAA,IAJV,KAAK;AAAA,EAKZ,CACD,GACH;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -25,7 +25,11 @@ export function CancelledSubscriptionBanner({ onReactivate }: CancelledSubscript
|
|
|
25
25
|
const isPastDue = today >= dueDate;
|
|
26
26
|
const formattedDate = formatShortDate(dueDate);
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const isTrial = subscription?.type === 'trial';
|
|
29
|
+
|
|
30
|
+
if (!visible) return null;
|
|
31
|
+
if (isTrial && !isPastDue) return null;
|
|
32
|
+
if (!isTrial && (!subscription?.date_cancellation || isPastDue)) return null;
|
|
29
33
|
|
|
30
34
|
return (
|
|
31
35
|
<div className="fixed top-[80px] md:top-0 lg:left-[273px] left-0 right-0 z-[60] flex justify-center pointer-events-none px-4 lg:px-0">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { ElementType } from 'react';
|
|
4
|
+
import Link from 'next/link';
|
|
4
5
|
import { useAppNavigationContext } from './AppNavigationContext';
|
|
5
6
|
import { useMobileNavbarSheet } from '../../store/useMobileNavbarSheet';
|
|
6
7
|
import { useMdSidebarStore } from '../../store/useMdSidebarStore';
|
|
@@ -8,17 +9,16 @@ import { useMdSidebarStore } from '../../store/useMdSidebarStore';
|
|
|
8
9
|
interface NavItemProps {
|
|
9
10
|
icon?: ElementType;
|
|
10
11
|
label: string;
|
|
11
|
-
|
|
12
|
+
href: string;
|
|
12
13
|
isActive?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export function NavItem({ icon: Icon, label,
|
|
16
|
+
export function NavItem({ icon: Icon, label, href, isActive = false }: NavItemProps) {
|
|
16
17
|
const { breakpoint } = useAppNavigationContext();
|
|
17
18
|
const { close } = useMobileNavbarSheet();
|
|
18
19
|
const { collapse } = useMdSidebarStore();
|
|
19
20
|
|
|
20
21
|
const handleClick = () => {
|
|
21
|
-
onClick();
|
|
22
22
|
if (breakpoint === 'mobile') {
|
|
23
23
|
close();
|
|
24
24
|
} else if (breakpoint === 'md') {
|
|
@@ -27,8 +27,10 @@ export function NavItem({ icon: Icon, label, onClick, isActive = false }: NavIte
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<
|
|
31
|
-
|
|
30
|
+
<Link
|
|
31
|
+
href={href}
|
|
32
|
+
prefetch
|
|
33
|
+
className={`rounded-md flex items-center gap-2 p-3 cursor-pointer transition-colors no-underline ${
|
|
32
34
|
isActive ? 'bg-gray-50' : 'bg-white hover:bg-gray-100'
|
|
33
35
|
} active:bg-gray-50`}
|
|
34
36
|
onClick={handleClick}
|
|
@@ -42,6 +44,6 @@ export function NavItem({ icon: Icon, label, onClick, isActive = false }: NavIte
|
|
|
42
44
|
<span className={`paragraph-small-medium ${isActive ? 'text-gray-950' : 'text-gray-500'}`}>
|
|
43
45
|
{label}
|
|
44
46
|
</span>
|
|
45
|
-
</
|
|
47
|
+
</Link>
|
|
46
48
|
);
|
|
47
49
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { ReactNode, useRef, useEffect } from 'react';
|
|
4
|
+
import Link from 'next/link';
|
|
4
5
|
import { AppNavigationContext } from '../AppNavigationContext';
|
|
5
6
|
import { useNavItemsContext } from '../NavItemsContext';
|
|
6
7
|
|
|
7
8
|
function InternalTabsBar({ topOffset = '72px' }: { topOffset?: string }) {
|
|
8
9
|
const { navItems } = useNavItemsContext();
|
|
9
10
|
const tabsListRef = useRef<HTMLDivElement>(null);
|
|
10
|
-
const activeTabRef = useRef<
|
|
11
|
+
const activeTabRef = useRef<HTMLAnchorElement>(null);
|
|
11
12
|
|
|
12
13
|
const activeLabel = navItems.find((i) => i.isActive)?.label;
|
|
13
14
|
|
|
@@ -33,10 +34,11 @@ function InternalTabsBar({ topOffset = '72px' }: { topOffset?: string }) {
|
|
|
33
34
|
style={{ top: topOffset }}
|
|
34
35
|
>
|
|
35
36
|
{navItems.map((item) => (
|
|
36
|
-
<
|
|
37
|
+
<Link
|
|
37
38
|
key={item.label}
|
|
38
39
|
ref={item.isActive ? activeTabRef : undefined}
|
|
39
|
-
|
|
40
|
+
href={item.href}
|
|
41
|
+
prefetch
|
|
40
42
|
className={`flex items-center gap-2 px-4 py-3 shrink-0 border-b-2 transition-colors ${
|
|
41
43
|
item.isActive
|
|
42
44
|
? 'border-gray-950 text-gray-950'
|
|
@@ -51,7 +53,7 @@ function InternalTabsBar({ topOffset = '72px' }: { topOffset?: string }) {
|
|
|
51
53
|
>
|
|
52
54
|
{item.label}
|
|
53
55
|
</span>
|
|
54
|
-
</
|
|
56
|
+
</Link>
|
|
55
57
|
))}
|
|
56
58
|
</div>
|
|
57
59
|
);
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
import { ElementType, useEffect } from 'react';
|
|
4
4
|
import { NavItem } from '../NavItem';
|
|
5
5
|
import { useNavItemsContext } from '../NavItemsContext';
|
|
6
|
+
import { useRouter } from 'next/navigation';
|
|
6
7
|
|
|
7
8
|
export interface NavItemConfig {
|
|
8
9
|
label: string;
|
|
9
10
|
isActive: boolean;
|
|
10
11
|
icon: ElementType;
|
|
11
|
-
|
|
12
|
+
href: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
interface NavItemsProps {
|
|
@@ -29,8 +30,8 @@ export function NavItems({ items }: NavItemsProps) {
|
|
|
29
30
|
key={item.label}
|
|
30
31
|
label={item.label}
|
|
31
32
|
icon={item.icon}
|
|
33
|
+
href={item.href}
|
|
32
34
|
isActive={item.isActive}
|
|
33
|
-
onClick={item.onClick}
|
|
34
35
|
/>
|
|
35
36
|
))}
|
|
36
37
|
</div>
|