feat(api, agents, i18n): enhance settlement features and multi-language support
Added new types and API functions for settlement period summaries and credit ledgers, improving the management of agent settlements. Updated the admin console to reflect these changes, enhancing user experience with better navigation and data presentation. Additionally, expanded multi-language support by incorporating new translations in English, Nepali, and Chinese for settlement-related terms, ensuring consistency across the platform.
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
SidebarMenuSub,
|
||||
SidebarMenuSubButton,
|
||||
SidebarMenuSubItem,
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar";
|
||||
import {
|
||||
ADMIN_NAV_GROUP_ICON,
|
||||
@@ -29,7 +30,7 @@ const NAV_BTN =
|
||||
"h-8 gap-2 px-2.5 py-0 text-[13px] leading-snug font-normal text-sidebar-foreground/90 hover:text-sidebar-accent-foreground [&_svg]:size-4";
|
||||
const NAV_ACTIVE = "data-active:bg-red-600 data-active:text-white data-active:font-medium data-active:shadow-sm";
|
||||
const SUB_NAV =
|
||||
"h-8 min-h-8 rounded-sm px-2.5 py-0 text-sm leading-snug font-normal text-sidebar-foreground/90 hover:text-sidebar-accent-foreground data-[size=md]:text-sm data-[size=sm]:text-sm [&>span]:text-sm";
|
||||
"h-8 min-h-8 gap-2 rounded-sm px-2.5 py-0 text-sm leading-snug font-normal text-sidebar-foreground/90 hover:text-sidebar-accent-foreground data-[size=md]:text-sm data-[size=sm]:text-sm [&>span]:text-sm [&_svg]:size-4";
|
||||
|
||||
function isActive(
|
||||
pathname: string,
|
||||
@@ -101,6 +102,7 @@ function NavSubLeaf({
|
||||
pathname: string;
|
||||
t: TFunction;
|
||||
}): ReactElement {
|
||||
const Icon = resolveAdminNavIcon(item.segment);
|
||||
const active = isActive(pathname, item);
|
||||
const label = adminNavLabel(item.segment, t, item.label);
|
||||
|
||||
@@ -112,6 +114,7 @@ function NavSubLeaf({
|
||||
render={<Link href={item.href} />}
|
||||
className={cn(SUB_NAV, NAV_ACTIVE)}
|
||||
>
|
||||
<Icon aria-hidden />
|
||||
<span>{label}</span>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
@@ -175,7 +178,9 @@ export function AdminSidebarNav({
|
||||
}): ReactElement {
|
||||
const { t } = useTranslation("common");
|
||||
const pathname = usePathname();
|
||||
const { state } = useSidebar();
|
||||
const navGroups = useMemo(() => groupAdminNavItems(items), [items]);
|
||||
const flatItems = useMemo(() => navGroups.flatMap((g) => g.items), [navGroups]);
|
||||
|
||||
const [openGroups, setOpenGroups] = useState<Record<AdminNavGroup, boolean>>(() =>
|
||||
defaultOpenGroups(navGroups, pathname),
|
||||
@@ -195,6 +200,16 @@ export function AdminSidebarNav({
|
||||
});
|
||||
}, [pathname, navGroups]);
|
||||
|
||||
if (state === "collapsed") {
|
||||
return (
|
||||
<SidebarMenu className="gap-0.5 px-1.5 py-1.5">
|
||||
{flatItems.map((item) => (
|
||||
<NavLeaf key={item.segment} item={item} pathname={pathname} t={t} />
|
||||
))}
|
||||
</SidebarMenu>
|
||||
);
|
||||
}
|
||||
|
||||
const overview = navGroups.find((g) => g.group === "overview");
|
||||
const collapsible = navGroups.filter((g) => g.group !== "overview");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user