From 570bc4b6dce87d40fa2e625ed600e8bb86588de0 Mon Sep 17 00:00:00 2001 From: matusilva Date: Tue, 6 Jan 2026 17:54:44 -0300 Subject: [PATCH] feat: update user management and settings structure - Change user navigation from "/users" to "/settings/users" - Remove MembersList component and related members page - Add AddModal and DeleteModal for user management - Implement List component for displaying users with actions - Update useAuth composable to improve user loading and management - Refactor dashboard shortcuts for better navigation - Enhance settings layout with new links for users and ads - Create anuncios page and update index page for user creation - Improve login page with error handling and navigation - Refactor settings page to include new user and ad management links - Remove unused members API endpoint and related types - Update ESLint configuration for better code style enforcement - Adjust Nuxt configuration for cleaner module imports --- app/components/TeamsMenu.vue | 74 ++-- app/components/UserMenu.vue | 273 +++++++------- app/components/home/HomeChart.client.vue | 103 +++--- app/components/home/HomeStats.vue | 2 +- app/components/settings/MembersList.vue | 60 ---- .../{ => settings}/users/AddModal.vue | 0 .../{ => settings}/users/DeleteModal.vue | 19 +- app/components/settings/users/List.vue | 72 ++++ app/composables/useAuth.ts | 34 +- app/composables/useDashboard.ts | 3 +- app/layouts/default.vue | 160 +++++---- app/pages/anuncios.vue | 4 + app/pages/index.vue | 2 +- app/pages/login.vue | 15 +- app/pages/settings.vue | 58 +-- app/pages/settings/index.vue | 78 ++-- app/pages/settings/members.vue | 45 --- app/pages/settings/users.vue | 67 ++++ app/pages/users.vue | 336 ------------------ app/types/index.d.ts | 9 +- eslint.config.mjs | 3 +- nuxt.config.ts | 9 +- server/api/members.ts | 60 ---- 23 files changed, 591 insertions(+), 895 deletions(-) delete mode 100644 app/components/settings/MembersList.vue rename app/components/{ => settings}/users/AddModal.vue (100%) rename app/components/{ => settings}/users/DeleteModal.vue (67%) create mode 100644 app/components/settings/users/List.vue delete mode 100644 app/pages/settings/members.vue create mode 100644 app/pages/settings/users.vue delete mode 100644 app/pages/users.vue delete mode 100644 server/api/members.ts diff --git a/app/components/TeamsMenu.vue b/app/components/TeamsMenu.vue index 072ac66..cb0ec9b 100644 --- a/app/components/TeamsMenu.vue +++ b/app/components/TeamsMenu.vue @@ -5,40 +5,50 @@ defineProps<{ collapsed?: boolean }>() -const teams = ref([{ - label: 'Nuxt', - avatar: { - src: 'https://github.com/nuxt.png', - alt: 'Nuxt' - } -}, { - label: 'NuxtHub', - avatar: { - src: 'https://github.com/nuxt-hub.png', - alt: 'NuxtHub' - } -}, { - label: 'NuxtLabs', - avatar: { - src: 'https://github.com/nuxtlabs.png', - alt: 'NuxtLabs' +const teams = ref([ + { + label: 'Nuxt', + avatar: { + src: 'https://github.com/nuxt.png', + alt: 'Nuxt' + } + }, + { + label: 'NuxtHub', + avatar: { + src: 'https://github.com/nuxt-hub.png', + alt: 'NuxtHub' + } + }, + { + label: 'NuxtLabs', + avatar: { + src: 'https://github.com/nuxtlabs.png', + alt: 'NuxtLabs' + } } -}]) +]) const selectedTeam = ref(teams.value[0]) const items = computed(() => { - return [teams.value.map(team => ({ - ...team, - onSelect() { - selectedTeam.value = team - } - })), [{ - label: 'Create team', - icon: 'i-lucide-circle-plus' - }, { - label: 'Manage teams', - icon: 'i-lucide-cog' - }]] + return [ + teams.value.map((team) => ({ + ...team, + onSelect() { + selectedTeam.value = team + } + })), + [ + { + label: 'Create team', + icon: 'i-lucide-circle-plus' + }, + { + label: 'Manage teams', + icon: 'i-lucide-cog' + } + ] + ] }) @@ -46,7 +56,9 @@ const items = computed(() => { -import { eachDayOfInterval, eachWeekOfInterval, eachMonthOfInterval, format } from 'date-fns' -import { VisXYContainer, VisLine, VisAxis, VisArea, VisCrosshair, VisTooltip } from '@unovis/vue' +import { + eachDayOfInterval, + eachWeekOfInterval, + eachMonthOfInterval, + format +} from 'date-fns' +import { + VisXYContainer, + VisLine, + VisAxis, + VisArea, + VisCrosshair, + VisTooltip +} from '@unovis/vue' import type { Period, Range } from '~/types' const cardRef = useTemplateRef('cardRef') @@ -19,32 +31,47 @@ const { width } = useElementSize(cardRef) const data = ref([]) -watch([() => props.period, () => props.range], () => { - const dates = ({ - daily: eachDayOfInterval, - weekly: eachWeekOfInterval, - monthly: eachMonthOfInterval - } as Record)[props.period](props.range) - - const min = 1000 - const max = 10000 - - data.value = dates.map(date => ({ date, amount: Math.floor(Math.random() * (max - min + 1)) + min })) -}, { immediate: true }) +watch( + [() => props.period, () => props.range], + () => { + const dates = ( + { + daily: eachDayOfInterval, + weekly: eachWeekOfInterval, + monthly: eachMonthOfInterval + } as Record + )[props.period](props.range) + + const min = 1000 + const max = 10000 + + data.value = dates.map((date) => ({ + date, + amount: Math.floor(Math.random() * (max - min + 1)) + min + })) + }, + { immediate: true } +) const x = (_: DataRecord, i: number) => i const y = (d: DataRecord) => d.amount -const total = computed(() => data.value.reduce((acc: number, { amount }) => acc + amount, 0)) +const total = computed(() => + data.value.reduce((acc: number, { amount }) => acc + amount, 0) +) -const formatNumber = new Intl.NumberFormat('en', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format +const formatNumber = new Intl.NumberFormat('en', { + style: 'currency', + currency: 'USD', + maximumFractionDigits: 0 +}).format const formatDate = (date: Date): string => { - return ({ + return { daily: format(date, 'd MMM'), weekly: format(date, 'd MMM'), monthly: format(date, 'MMM yyy') - })[props.period] + }[props.period] } const xTicks = (i: number) => { @@ -55,16 +82,18 @@ const xTicks = (i: number) => { return formatDate(data.value[i].date) } -const template = (d: DataRecord) => `${formatDate(d.date)}: ${formatNumber(d.amount)}` +const template = (d: DataRecord) => + `${formatDate(d.date)}: ${formatNumber(d.amount)}`