forked from git.gladyson/openmonetis
refactor(inbox): rename caixa-de-entrada to pre-lancamentos e remove colunas não utilizadas
BREAKING CHANGES: - Renomeia rota /caixa-de-entrada para /pre-lancamentos - Remove colunas device_id, parsed_date e discard_reason da tabela inbox_items Mudanças: - Move componentes de caixa-de-entrada para pre-lancamentos - Atualiza sidebar e navegação para nova rota - Remove campos não utilizados do schema, types e APIs - Adiciona migration 0011 para remover colunas do banco - Simplifica lógica de data padrão usando notificationTimestamp
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar";
|
||||
import * as React from "react";
|
||||
import { createSidebarNavData, type PagadorLike } from "./nav-link";
|
||||
import { createSidebarNavData, type PagadorLike, type SidebarNavOptions } from "./nav-link";
|
||||
|
||||
type AppUser = {
|
||||
id: string;
|
||||
@@ -27,12 +27,14 @@ interface AppSidebarProps extends React.ComponentProps<typeof Sidebar> {
|
||||
user: AppUser;
|
||||
pagadorAvatarUrl: string | null;
|
||||
pagadores: PagadorLike[];
|
||||
preLancamentosCount?: number;
|
||||
}
|
||||
|
||||
export function AppSidebar({
|
||||
user,
|
||||
pagadorAvatarUrl,
|
||||
pagadores,
|
||||
preLancamentosCount = 0,
|
||||
...props
|
||||
}: AppSidebarProps) {
|
||||
if (!user) {
|
||||
@@ -40,8 +42,8 @@ export function AppSidebar({
|
||||
}
|
||||
|
||||
const navigation = React.useMemo(
|
||||
() => createSidebarNavData(pagadores),
|
||||
[pagadores]
|
||||
() => createSidebarNavData({ pagadores, preLancamentosCount }),
|
||||
[pagadores, preLancamentosCount]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -25,6 +25,7 @@ export type SidebarSubItem = {
|
||||
isShared?: boolean;
|
||||
key?: string;
|
||||
icon?: RemixiconComponentType;
|
||||
badge?: number;
|
||||
};
|
||||
|
||||
export type SidebarItem = {
|
||||
@@ -56,7 +57,13 @@ export interface PagadorLike {
|
||||
canEdit?: boolean;
|
||||
}
|
||||
|
||||
export function createSidebarNavData(pagadores: PagadorLike[]): SidebarNavData {
|
||||
export interface SidebarNavOptions {
|
||||
pagadores: PagadorLike[];
|
||||
preLancamentosCount?: number;
|
||||
}
|
||||
|
||||
export function createSidebarNavData(options: SidebarNavOptions): SidebarNavData {
|
||||
const { pagadores, preLancamentosCount = 0 } = options;
|
||||
const pagadorItems = pagadores
|
||||
.map((pagador) => ({
|
||||
title: pagador.name?.trim().length
|
||||
@@ -88,15 +95,19 @@ export function createSidebarNavData(pagadores: PagadorLike[]): SidebarNavData {
|
||||
{
|
||||
title: "Gestão Financeira",
|
||||
items: [
|
||||
{
|
||||
title: "Caixa de Entrada",
|
||||
url: "/caixa-de-entrada",
|
||||
icon: RiInboxLine,
|
||||
},
|
||||
{
|
||||
title: "Lançamentos",
|
||||
url: "/lancamentos",
|
||||
icon: RiArrowLeftRightLine,
|
||||
items: [
|
||||
{
|
||||
title: "Pré-Lançamentos",
|
||||
url: "/pre-lancamentos",
|
||||
key: "pre-lancamentos",
|
||||
icon: RiInboxLine,
|
||||
badge: preLancamentosCount > 0 ? preLancamentosCount : undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Calendário",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import {
|
||||
Collapsible,
|
||||
CollapsibleContent,
|
||||
@@ -40,6 +41,7 @@ type NavItem = {
|
||||
isShared?: boolean;
|
||||
key?: string;
|
||||
icon?: RemixiconComponentType;
|
||||
badge?: number;
|
||||
}[];
|
||||
};
|
||||
|
||||
@@ -181,6 +183,11 @@ export function NavMain({ sections }: { sections: NavSection[] }) {
|
||||
</Avatar>
|
||||
) : null}
|
||||
<span>{subItem.title}</span>
|
||||
{subItem.badge ? (
|
||||
<Badge variant="destructive" className="ml-auto h-5 min-w-5 px-1.5 text-xs">
|
||||
{subItem.badge}
|
||||
</Badge>
|
||||
) : null}
|
||||
{subItem.isShared ? (
|
||||
<RiUserSharedLine className="size-3.5 text-muted-foreground" />
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user