feat: implementar sistema de preferências do usuário e refatorar changelog
Adiciona sistema completo de preferências de usuário: - Cria tabela userPreferences no schema com campos disableMagnetlines, periodMonthsBefore e periodMonthsAfter - Implementa página de Ajustes com abas (Preferências, Alterar nome, Senha, E-mail, Deletar conta) - Adiciona componente PreferencesForm para configuração de magnetlines e períodos de exibição - Propaga periodPreferences para todos os componentes de lançamentos e calendário Refatora sistema de changelog: - Remove implementação anterior baseada em JSON estático - Adiciona nova página de changelog dinâmica em app/(dashboard)/changelog - Adiciona componente changelog-list.tsx - Remove arquivos obsoletos (changelog-notification, actions, data, utils, scripts) Adiciona controle de saldo inicial em contas: - Novo campo excludeInitialBalanceFromIncome em contas - Permite excluir saldo inicial do cálculo de receitas - Atualiza queries de lançamentos para respeitar esta configuração Melhorias adicionais: - Adiciona componente ui/accordion.tsx do shadcn/ui - Refatora formatPeriodLabel para displayPeriod centralizado - Propaga estabelecimentos para componentes de lançamentos - Remove variável DB_PROVIDER obsoleta do .env.example e documentação - Adiciona 6 migrações de banco de dados (0003-0008)
This commit is contained in:
@@ -55,6 +55,8 @@ export const getPaymentMethodIcon = (paymentMethod: string): ReactNode => {
|
||||
<RemixIcons.RiBankCardLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
debito: <RemixIcons.RiBankCardLine className={ICON_CLASS} aria-hidden />,
|
||||
prepagovrva: <RemixIcons.RiCouponLine className={ICON_CLASS} aria-hidden />,
|
||||
transferenciabancaria: <RemixIcons.RiExchangeLine className={ICON_CLASS} aria-hidden />,
|
||||
};
|
||||
|
||||
return registry[key] ?? null;
|
||||
|
||||
@@ -367,17 +367,24 @@ export type SelectOption = {
|
||||
/**
|
||||
* Creates month options for a select dropdown, centered around current month
|
||||
* @param currentValue - Current period value to ensure it's included in options
|
||||
* @param offsetRange - Number of months before/after current month (default: 3)
|
||||
* @param monthsBefore - Number of months before current month (default: 3)
|
||||
* @param monthsAfter - Number of months after current month (default: same as monthsBefore)
|
||||
* @returns Array of select options with formatted labels
|
||||
* @example
|
||||
* createMonthOptions() // -3 to +3
|
||||
* createMonthOptions(undefined, 3) // -3 to +3
|
||||
* createMonthOptions(undefined, 3, 6) // -3 to +6
|
||||
*/
|
||||
export function createMonthOptions(
|
||||
currentValue?: string,
|
||||
offsetRange: number = 3
|
||||
monthsBefore: number = 3,
|
||||
monthsAfter?: number
|
||||
): SelectOption[] {
|
||||
const now = new Date();
|
||||
const options: SelectOption[] = [];
|
||||
const after = monthsAfter ?? monthsBefore; // If not specified, use same as before
|
||||
|
||||
for (let offset = -offsetRange; offset <= offsetRange; offset += 1) {
|
||||
for (let offset = -monthsBefore; offset <= after; offset += 1) {
|
||||
const date = new Date(now.getFullYear(), now.getMonth() + offset, 1);
|
||||
const value = formatPeriod(date.getFullYear(), date.getMonth() + 1);
|
||||
options.push({ value, label: displayPeriod(value) });
|
||||
|
||||
Reference in New Issue
Block a user