analytica-frontend-lib 1.6.19 → 1.6.21
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/ActivitiesHistory/index.js +9 -9
- package/dist/ActivitiesHistory/index.mjs +8 -8
- package/dist/ActivityCardQuestionBanks/index.js +9 -9
- package/dist/ActivityCardQuestionBanks/index.mjs +8 -8
- package/dist/ActivityCardQuestionPreview/index.js +9 -9
- package/dist/ActivityCardQuestionPreview/index.mjs +8 -8
- package/dist/ActivityCreate/ActivityCreateContent/index.js +9 -9
- package/dist/ActivityCreate/ActivityCreateContent/index.mjs +8 -8
- package/dist/ActivityCreate/index.js +9 -9
- package/dist/ActivityCreate/index.mjs +8 -8
- package/dist/ActivityDetails/index.js +9 -9
- package/dist/ActivityDetails/index.mjs +8 -8
- package/dist/ActivityFilters/index.js +9 -9
- package/dist/ActivityFilters/index.mjs +8 -8
- package/dist/ActivityPageLayout/index.js +9 -9
- package/dist/ActivityPageLayout/index.mjs +8 -8
- package/dist/ActivityPreview/index.js +9 -9
- package/dist/ActivityPreview/index.mjs +8 -8
- package/dist/AlertManager/index.js +9 -9
- package/dist/AlertManager/index.mjs +8 -8
- package/dist/AppHeader/index.d.ts.map +1 -1
- package/dist/AppHeader/index.js +5 -5
- package/dist/AppHeader/index.mjs +4 -4
- package/dist/CalendarCard/index.js +3 -3
- package/dist/CalendarCard/index.mjs +2 -2
- package/dist/CheckBoxGroup/index.js +9 -9
- package/dist/CheckBoxGroup/index.mjs +8 -8
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/DropdownMenu/index.mjs +1 -1
- package/dist/ExamDetailsLayout/ExamDetailsPage/index.js +9 -9
- package/dist/ExamDetailsLayout/ExamDetailsPage/index.mjs +8 -8
- package/dist/ExamPageLayout/index.js +9 -9
- package/dist/ExamPageLayout/index.mjs +8 -8
- package/dist/Forum/index.js +3 -3
- package/dist/Forum/index.mjs +2 -2
- package/dist/NotificationCard/index.js +3 -3
- package/dist/NotificationCard/index.mjs +2 -2
- package/dist/PrintableUsersTable/index.js +9 -9
- package/dist/PrintableUsersTable/index.mjs +8 -8
- package/dist/QuestionsPerformanceCard/index.js +9 -9
- package/dist/QuestionsPerformanceCard/index.mjs +8 -8
- package/dist/RecommendedLessonCreate/index.js +9 -9
- package/dist/RecommendedLessonCreate/index.mjs +8 -8
- package/dist/RecommendedLessonsHistory/index.js +9 -9
- package/dist/RecommendedLessonsHistory/index.mjs +8 -8
- package/dist/Search/index.js +3 -3
- package/dist/Search/index.mjs +2 -2
- package/dist/SendActivityModal/SendActivityModal.js +9 -9
- package/dist/SendActivityModal/SendActivityModal.mjs +8 -8
- package/dist/SendActivityModal/index.js +9 -9
- package/dist/SendActivityModal/index.mjs +8 -8
- package/dist/SendLessonModal/index.js +9 -9
- package/dist/SendLessonModal/index.mjs +8 -8
- package/dist/SimulatedPerformance/SimulatedPerformanceView/index.js +9 -9
- package/dist/SimulatedPerformance/SimulatedPerformanceView/index.mjs +8 -8
- package/dist/SimulatedStudentSimulationsModal/index.js +15 -15
- package/dist/SimulatedStudentSimulationsModal/index.mjs +1 -1
- package/dist/SimulationsPage/index.js +9 -9
- package/dist/SimulationsPage/index.mjs +8 -8
- package/dist/TableProvider/index.js +9 -9
- package/dist/TableProvider/index.mjs +8 -8
- package/dist/UnifiedDraftModelPage/index.js +9 -9
- package/dist/UnifiedDraftModelPage/index.mjs +8 -8
- package/dist/UnifiedHistoryPage/index.js +9 -9
- package/dist/UnifiedHistoryPage/index.mjs +8 -8
- package/dist/{chunk-OMNDC4BZ.js → chunk-7XWWI5EY.js} +25 -28
- package/dist/chunk-7XWWI5EY.js.map +1 -0
- package/dist/{chunk-6LJZGFSL.mjs → chunk-CFTQ24UT.mjs} +2 -2
- package/dist/{chunk-LLUJLIDC.mjs → chunk-CKSOC6YI.mjs} +5 -4
- package/dist/{chunk-LLUJLIDC.mjs.map → chunk-CKSOC6YI.mjs.map} +1 -1
- package/dist/{chunk-DXSNLRL4.mjs → chunk-CWGYVJTQ.mjs} +25 -28
- package/dist/chunk-CWGYVJTQ.mjs.map +1 -0
- package/dist/{chunk-OYEDIVC2.js → chunk-CWTCN6F7.js} +5 -5
- package/dist/{chunk-OYEDIVC2.js.map → chunk-CWTCN6F7.js.map} +1 -1
- package/dist/{chunk-QKRUOG3N.mjs → chunk-E4MLDRLD.mjs} +2 -2
- package/dist/{chunk-GP47TASX.mjs → chunk-ENCFJBY5.mjs} +2 -2
- package/dist/{chunk-FBA6QDJM.js → chunk-IUH7JW7H.js} +16 -15
- package/dist/chunk-IUH7JW7H.js.map +1 -0
- package/dist/{chunk-UEUGH2QZ.js → chunk-KYGFYAU7.js} +7 -7
- package/dist/{chunk-UEUGH2QZ.js.map → chunk-KYGFYAU7.js.map} +1 -1
- package/dist/{chunk-T3V5QTJZ.mjs → chunk-MUVQIQAG.mjs} +2 -2
- package/dist/{chunk-7HW4PZLV.js → chunk-MYQ2LJWO.js} +6 -6
- package/dist/{chunk-7HW4PZLV.js.map → chunk-MYQ2LJWO.js.map} +1 -1
- package/dist/{chunk-K2ILHIT6.mjs → chunk-NAOHJW6H.mjs} +4 -4
- package/dist/{chunk-S4CNM57F.js → chunk-QHXJB5QM.js} +10 -10
- package/dist/{chunk-S4CNM57F.js.map → chunk-QHXJB5QM.js.map} +1 -1
- package/dist/{chunk-IXZT6MKP.js → chunk-QN32O3J3.js} +19 -19
- package/dist/{chunk-IXZT6MKP.js.map → chunk-QN32O3J3.js.map} +1 -1
- package/dist/{chunk-PTFHHHQG.mjs → chunk-X2YQT5BS.mjs} +22 -7
- package/dist/chunk-X2YQT5BS.mjs.map +1 -0
- package/dist/{chunk-M5BZW7BG.js → chunk-Y64LT6BL.js} +22 -7
- package/dist/chunk-Y64LT6BL.js.map +1 -0
- package/dist/components/SimulationsPage/SimulationsDetailModal.d.ts.map +1 -1
- package/dist/hooks/useAppContent/index.js +9 -9
- package/dist/hooks/useAppContent/index.mjs +8 -8
- package/dist/index.js +9 -9
- package/dist/index.mjs +8 -8
- package/dist/utils/questionDuration.d.ts +14 -12
- package/dist/utils/questionDuration.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-DXSNLRL4.mjs.map +0 -1
- package/dist/chunk-FBA6QDJM.js.map +0 -1
- package/dist/chunk-M5BZW7BG.js.map +0 -1
- package/dist/chunk-OMNDC4BZ.js.map +0 -1
- package/dist/chunk-PTFHHHQG.mjs.map +0 -1
- /package/dist/{chunk-6LJZGFSL.mjs.map → chunk-CFTQ24UT.mjs.map} +0 -0
- /package/dist/{chunk-QKRUOG3N.mjs.map → chunk-E4MLDRLD.mjs.map} +0 -0
- /package/dist/{chunk-GP47TASX.mjs.map → chunk-ENCFJBY5.mjs.map} +0 -0
- /package/dist/{chunk-T3V5QTJZ.mjs.map → chunk-MUVQIQAG.mjs.map} +0 -0
- /package/dist/{chunk-K2ILHIT6.mjs.map → chunk-NAOHJW6H.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AppHeader/AppHeader.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useEffect, useState } from 'react';\nimport { CaretRightIcon } from '@phosphor-icons/react/dist/csr/CaretRight';\nimport { UserIcon as UserPhosphorIcon } from '@phosphor-icons/react/dist/csr/User';\n\nimport { BrandingLogo } from '../BrandingLogo/BrandingLogo';\nimport CalendarCard from '../CalendarCard/CalendarCard';\nimport IconButton from '../IconButton/IconButton';\nimport DropdownMenu, {\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n ProfileMenuFooter,\n ProfileMenuHeader,\n ProfileMenuInfo,\n ProfileMenuSection,\n ProfileToggleTheme,\n} from '../DropdownMenu/DropdownMenu';\nimport NotificationCard, {\n type NotificationGroup,\n} from '../NotificationCard/NotificationCard';\nimport { PageContainer } from '../PageContainer/PageContainer';\nimport Text from '../Text/Text';\nimport { UserIcon } from '../UserIcon/UserIcon';\nimport { useMobile } from '../../hooks/useMobile';\nimport { syncDropdownState } from '../../utils/dropdown';\nimport {\n NotificationEntityType,\n NotificationEntityStatus,\n} from '../../types/notifications';\n\n/**\n * Subset of session info consumed by the application header.\n * Each property is optional so the consumer can pass whatever it has.\n */\nexport interface AppHeaderSessionInfo {\n userName?: string;\n email?: string;\n urlProfilePicture?: string;\n schoolName?: string;\n className?: string;\n schoolYearName?: string;\n}\n\n/**\n * Minimal user shape needed to fill the profile dropdown header.\n */\nexport interface AppHeaderUser {\n name?: string;\n email?: string;\n}\n\n/**\n * Tutorial action rendered as a pill button in the header (left of the\n * notifications bell). The consumer owns the click behavior (usually opening\n * the configured tutorial URL in a new tab).\n */\nexport interface AppHeaderTutorial {\n /** Show the tutorial button. */\n visible?: boolean;\n /** Button label. Defaults to \"Tutoriais\". */\n label?: string;\n /** Fired when the tutorial button is clicked. */\n onClick: () => void;\n}\n\n/**\n * Notifications data + callbacks the AppHeader forwards to NotificationCard.\n * Built by the consumer (usually via `createNotificationsHook(api)`).\n */\nexport interface AppHeaderNotifications {\n unreadCount: number;\n loading: boolean;\n error: string | null;\n groupedNotifications: NotificationGroup[];\n refreshNotifications: () => void;\n markAsRead: (id: string) => void;\n deleteNotification: (id: string) => void;\n fetchNotifications: () => void;\n fetchUnreadCount?: () => void;\n /**\n * Optional bulk action. When provided, the \"Marcar todas como lidas\" button\n * renders in the notification center; when omitted, it stays hidden, which is\n * the behaviour every consumer had before this prop existed.\n */\n markAllAsRead?: () => void;\n getActionLabel: (entityType?: NotificationEntityType) => string | undefined;\n}\n\nexport interface AppHeaderProps {\n /** Authenticated user (fallback when sessionInfo doesn't carry name/email). */\n user?: AppHeaderUser;\n /** Session metadata used to render profile name, email, photo and school info. */\n sessionInfo?: AppHeaderSessionInfo;\n /** Notifications wiring (state + callbacks). */\n notifications: AppHeaderNotifications;\n /** Tutorial pill button shown before the notifications bell. */\n tutorial?: AppHeaderTutorial;\n /** Show the calendar widget in the header. */\n showCalendar?: boolean;\n /** Content rendered inside the calendar (dropdown on tablet/desktop, modal on mobile). */\n calendarContent?: ReactNode;\n /**\n * Optional controlled open state for the calendar.\n * When provided, the consumer is the source of truth; useful for closing\n * the calendar programmatically (e.g. on route change).\n */\n calendarOpen?: boolean;\n /** Fired whenever the calendar open state changes. */\n onCalendarOpenChange?: (open: boolean) => void;\n /** Show school/class/year inside the profile dropdown. */\n showProfileInfo?: boolean;\n /** Optional fallback image for the notifications empty state. */\n emptyNotificationsImage?: string;\n /** Empty-state title for notifications dropdown. */\n emptyNotificationsTitle?: string;\n /** Empty-state description for notifications dropdown. */\n emptyNotificationsDescription?: string;\n /** Callback fired when the user activates logout. */\n onLogout: () => void;\n /** Callback fired when the user activates the \"My data\" menu item. */\n onNavigateToMyData: () => void;\n /** Callback fired when the user clicks on a notification with entity info. */\n onNavigateByNotification?: (\n entityType?: NotificationEntityType,\n entityId?: string,\n entityStatus?: NotificationEntityStatus | null,\n questionId?: string | null\n ) => void;\n /**\n * Tailwind class overriding the default `max-w-[1000px]` of the header\n * content (forwarded to the internal `PageContainer`'s `innerClassName`).\n * Pass e.g. `max-w-[1350px]` to align the header with a widened page\n * content. When omitted, the default `max-w-[1000px]` is kept, so other\n * consumers are unaffected.\n */\n contentMaxWidth?: string;\n}\n\nconst DEFAULT_EMPTY_TITLE = 'Nenhuma notificação no momento';\nconst DEFAULT_EMPTY_DESCRIPTION =\n 'Você está em dia com todas as novidades. Volte depois para conferir atualizações!';\n\n/**\n * Application header shared across the analytica frontends.\n *\n * Renders the institution logo, optional calendar dropdown (mobile/tablet),\n * notifications center and a profile menu. Width is constrained by\n * `<PageContainer>` so it always aligns with the rest of the page content.\n */\nexport const AppHeader = ({\n user,\n sessionInfo,\n notifications,\n tutorial,\n showCalendar = false,\n calendarContent,\n calendarOpen,\n onCalendarOpenChange,\n showProfileInfo = false,\n emptyNotificationsImage,\n emptyNotificationsTitle = DEFAULT_EMPTY_TITLE,\n emptyNotificationsDescription = DEFAULT_EMPTY_DESCRIPTION,\n onLogout,\n onNavigateToMyData,\n onNavigateByNotification,\n contentMaxWidth,\n}: AppHeaderProps) => {\n const { isMobile, isExtraSmallMobile } = useMobile();\n const [activeStates, setActiveStates] = useState<Record<string, boolean>>({});\n\n useEffect(() => {\n notifications.fetchUnreadCount?.();\n }, []);\n\n const toggleActive = (buttonId: string) => {\n setActiveStates((prev) => {\n if (prev[buttonId]) {\n return { ...prev, [buttonId]: false };\n }\n return {\n calendar: false,\n notifications: false,\n profile: false,\n [buttonId]: true,\n };\n });\n };\n\n // Stable callback so `DropdownMenu`'s `useEffect [open, onOpenChange]`\n // doesn't re-fire on every parent re-render, which would cascade into a\n // Maximum-update-depth loop (same root cause class as PR #435).\n const handleCalendarOpenChange = useCallback(\n (open: boolean) => {\n setActiveStates((prev) => {\n const current = prev.calendar ?? false;\n if (current === open) {\n return prev;\n }\n if (open) {\n return {\n calendar: true,\n notifications: false,\n profile: false,\n };\n }\n return { ...prev, calendar: false };\n });\n onCalendarOpenChange?.(open);\n },\n [onCalendarOpenChange]\n );\n\n useEffect(() => {\n const handleEscapeKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setActiveStates({});\n }\n };\n document.addEventListener('keydown', handleEscapeKey);\n return () => document.removeEventListener('keydown', handleEscapeKey);\n }, []);\n\n const handleMyDataClick = () => {\n setActiveStates({});\n onNavigateToMyData();\n };\n\n const displayName = sessionInfo?.userName ?? user?.name ?? 'Usuário';\n const displayEmail = sessionInfo?.email ?? user?.email ?? '';\n\n const pickResponsiveClass = (\n extraSmall: string,\n mobile: string,\n desktop: string\n ): string => {\n if (isExtraSmallMobile) return extraSmall;\n if (isMobile) return mobile;\n return desktop;\n };\n const profileDropdownWidth = pickResponsiveClass(\n 'min-w-[260px]',\n 'min-w-[280px]',\n 'min-w-[320px]'\n );\n const sectionGap = pickResponsiveClass('gap-1', 'gap-2', 'gap-3');\n const logoHeight = pickResponsiveClass('h-6', 'h-8', 'h-10');\n const tutorialPadding = pickResponsiveClass(\n 'px-3 py-1.5 text-xs',\n 'px-3.5 py-2 text-sm',\n 'px-4 py-2 text-sm'\n );\n\n return (\n <header\n data-component=\"AppHeader\"\n className=\"bg-primary-800 w-full h-[70px] flex justify-center items-center\"\n >\n <PageContainer\n className=\"pb-0 justify-center\"\n innerClassName={contentMaxWidth}\n >\n <div className=\"w-full flex flex-row justify-between items-center gap-3\">\n {/* `min-w-0 shrink` lets the logo compress instead of overflowing:\n an <img> resolves `min-width:auto` to its intrinsic width, which\n would otherwise block flex-shrink and push the actions off-screen\n on narrow viewports. `object-left` keeps it left-aligned as it\n scales down. The actions never shrink. */}\n <BrandingLogo\n variant=\"main\"\n alt=\"Logo\"\n className={`${logoHeight} object-contain object-left min-w-0 shrink`}\n />\n <section\n className={`flex flex-row items-center shrink-0 ${sectionGap}`}\n >\n {tutorial?.visible && (\n <button\n type=\"button\"\n data-testid=\"app-header-tutorial\"\n onClick={tutorial.onClick}\n /* `primary` (não `text`) é o foreground de `primary-800` em\n todos os temas — os dois formam um par contrastante mesmo\n onde o dark inverte o header (paraiba/analytica). Usar\n `text-*` aqui inverteria com o modo enquanto o fundo do\n header não inverte, apagando o botão no dark. */\n className={`rounded-full border border-primary text-primary font-medium whitespace-nowrap cursor-pointer transition-colors hover:bg-primary-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${tutorialPadding}`}\n >\n {tutorial.label ?? 'Tutoriais'}\n </button>\n )}\n\n {showCalendar && (\n <div className=\"lg:hidden\">\n <CalendarCard\n content={calendarContent}\n isOpen={calendarOpen ?? activeStates.calendar ?? false}\n onOpenChange={handleCalendarOpenChange}\n />\n </div>\n )}\n\n <NotificationCard\n mode=\"center\"\n isActive={activeStates.notifications}\n onToggleActive={() => toggleActive('notifications')}\n onOpenChange={(open: boolean) => {\n syncDropdownState(\n open,\n activeStates.notifications,\n setActiveStates,\n 'notifications'\n );\n }}\n unreadCount={notifications.unreadCount}\n groupedNotifications={notifications.groupedNotifications}\n loading={notifications.loading}\n error={notifications.error}\n onRetry={notifications.refreshNotifications}\n onMarkAsReadById={notifications.markAsRead}\n onMarkAllAsRead={notifications.markAllAsRead}\n onDeleteById={notifications.deleteNotification}\n onNavigateById={(\n entityType,\n entityId,\n entityStatus,\n questionId\n ) => {\n if (entityType && entityId) {\n // Fecha o painel antes de navegar. Sem isso, quando o destino\n // é a própria página em que o usuário já está (ex.: ele\n // termina a atividade, cai no resultado, abre o sino e clica\n // em \"Ver resultado\" da notificação dessa mesma atividade),\n // o navigate para a rota atual não muda nada na tela, o\n // painel segue aberto e ele clica de novo — rage click\n // FRONTEND-ALUNO-WEB-F3, 91 ocorrências / 36 usuários em seis\n // semanas. Fechar o painel é o feedback visível que faltava,\n // e vale para qualquer destino.\n //\n // É um setState em handler de clique, não em render/efeito:\n // não reabre o loop do PR #435. E o onOpenChange que o\n // DropdownMenu dispara ao fechar vira no-op no\n // syncDropdownState, porque isActive já estará false.\n setActiveStates((prev) => ({\n ...prev,\n notifications: false,\n }));\n onNavigateByNotification?.(\n entityType,\n entityId,\n entityStatus,\n questionId\n );\n }\n }}\n getActionLabel={notifications.getActionLabel}\n onFetchNotifications={notifications.fetchNotifications}\n emptyStateImage={emptyNotificationsImage}\n emptyStateTitle={emptyNotificationsTitle}\n emptyStateDescription={emptyNotificationsDescription}\n />\n\n <DropdownMenu\n onOpenChange={(open: boolean) => {\n syncDropdownState(\n open,\n activeStates.profile,\n setActiveStates,\n 'profile'\n );\n }}\n >\n <DropdownMenuTrigger\n className=\"text-primary cursor-pointer\"\n asChild\n >\n <IconButton\n active={activeStates.profile}\n onClick={() => toggleActive('profile')}\n icon={\n <UserIcon\n size={24}\n className={activeStates.profile ? 'opacity-80' : ''}\n />\n }\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className={profileDropdownWidth}\n side=\"bottom\"\n variant=\"profile\"\n align=\"end\"\n >\n <ProfileMenuHeader\n name={displayName}\n email={displayEmail}\n photoUrl={sessionInfo?.urlProfilePicture}\n />\n\n {showProfileInfo && (\n <ProfileMenuInfo\n schoolName={sessionInfo?.schoolName ?? ''}\n classYearName={sessionInfo?.className ?? ''}\n schoolYearName={sessionInfo?.schoolYearName ?? ''}\n />\n )}\n\n <ProfileMenuSection>\n <DropdownMenuItem\n variant=\"profile\"\n iconLeft={<UserPhosphorIcon />}\n iconRight={<CaretRightIcon />}\n onClick={handleMyDataClick}\n >\n <Text size=\"md\" color=\"text-text-700\">\n Meus dados\n </Text>\n </DropdownMenuItem>\n\n <ProfileToggleTheme />\n </ProfileMenuSection>\n\n <ProfileMenuFooter onClick={onLogout} />\n </DropdownMenuContent>\n </DropdownMenu>\n </section>\n </div>\n </PageContainer>\n </header>\n );\n};\n\nexport default AppHeader;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,sBAAsB;AAC/B,SAAS,YAAY,wBAAwB;AAyQnC,cA2IM,YA3IN;AAjIV,IAAM,sBAAsB;AAC5B,IAAM,4BACJ;AASK,IAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA,0BAA0B;AAAA,EAC1B,gCAAgC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,EAAE,UAAU,mBAAmB,IAAI,UAAU;AACnD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAkC,CAAC,CAAC;AAE5E,YAAU,MAAM;AACd,kBAAc,mBAAmB;AAAA,EACnC,GAAG,CAAC,CAAC;AAEL,QAAM,eAAe,CAAC,aAAqB;AACzC,oBAAgB,CAAC,SAAS;AACxB,UAAI,KAAK,QAAQ,GAAG;AAClB,eAAO,EAAE,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM;AAAA,MACtC;AACA,aAAO;AAAA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AU,oBAAC,oBAAiB;AAAA,oCAC5B,WAAW,oBAAC,kBAAe;AAAA,oCAC3B,SAAS;AAAA,oCAET,8BAAC,gBAAK,MAAK,MAAK,OAAM,iBAAgB,wBAEtC;AAAA;AAAA,gCACF;AAAA,gCAEA,oBAAC,sBAAmB;AAAA,iCACtB;AAAA,8BAEA,oBAAC,qBAAkB,SAAS,UAAU;AAAA;AAAA;AAAA,wBACxC;AAAA;AAAA;AAAA,kBACF;AAAA;AAAA;AAAA,YACF;AAAA,aACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,oBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/AppHeader/AppHeader.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useEffect, useState } from 'react';\nimport { CaretRightIcon } from '@phosphor-icons/react/dist/csr/CaretRight';\nimport { UserIcon as UserPhosphorIcon } from '@phosphor-icons/react/dist/csr/User';\n\nimport { BrandingLogo } from '../BrandingLogo/BrandingLogo';\nimport CalendarCard from '../CalendarCard/CalendarCard';\nimport IconButton from '../IconButton/IconButton';\nimport DropdownMenu, {\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n ProfileMenuFooter,\n ProfileMenuHeader,\n ProfileMenuInfo,\n ProfileMenuSection,\n ProfileToggleTheme,\n} from '../DropdownMenu/DropdownMenu';\nimport NotificationCard, {\n type NotificationGroup,\n} from '../NotificationCard/NotificationCard';\nimport { PageContainer } from '../PageContainer/PageContainer';\nimport Text from '../Text/Text';\nimport { UserIcon } from '../UserIcon/UserIcon';\nimport { useMobile } from '../../hooks/useMobile';\nimport { syncDropdownState } from '../../utils/dropdown';\nimport {\n NotificationEntityType,\n NotificationEntityStatus,\n} from '../../types/notifications';\n\n/**\n * Subset of session info consumed by the application header.\n * Each property is optional so the consumer can pass whatever it has.\n */\nexport interface AppHeaderSessionInfo {\n userName?: string;\n email?: string;\n urlProfilePicture?: string;\n schoolName?: string;\n className?: string;\n schoolYearName?: string;\n}\n\n/**\n * Minimal user shape needed to fill the profile dropdown header.\n */\nexport interface AppHeaderUser {\n name?: string;\n email?: string;\n}\n\n/**\n * Tutorial action rendered as a pill button in the header (left of the\n * notifications bell). The consumer owns the click behavior (usually opening\n * the configured tutorial URL in a new tab).\n */\nexport interface AppHeaderTutorial {\n /** Show the tutorial button. */\n visible?: boolean;\n /** Button label. Defaults to \"Tutoriais\". */\n label?: string;\n /** Fired when the tutorial button is clicked. */\n onClick: () => void;\n}\n\n/**\n * Notifications data + callbacks the AppHeader forwards to NotificationCard.\n * Built by the consumer (usually via `createNotificationsHook(api)`).\n */\nexport interface AppHeaderNotifications {\n unreadCount: number;\n loading: boolean;\n error: string | null;\n groupedNotifications: NotificationGroup[];\n refreshNotifications: () => void;\n markAsRead: (id: string) => void;\n deleteNotification: (id: string) => void;\n fetchNotifications: () => void;\n fetchUnreadCount?: () => void;\n /**\n * Optional bulk action. When provided, the \"Marcar todas como lidas\" button\n * renders in the notification center; when omitted, it stays hidden, which is\n * the behaviour every consumer had before this prop existed.\n */\n markAllAsRead?: () => void;\n getActionLabel: (entityType?: NotificationEntityType) => string | undefined;\n}\n\nexport interface AppHeaderProps {\n /** Authenticated user (fallback when sessionInfo doesn't carry name/email). */\n user?: AppHeaderUser;\n /** Session metadata used to render profile name, email, photo and school info. */\n sessionInfo?: AppHeaderSessionInfo;\n /** Notifications wiring (state + callbacks). */\n notifications: AppHeaderNotifications;\n /** Tutorial pill button shown before the notifications bell. */\n tutorial?: AppHeaderTutorial;\n /** Show the calendar widget in the header. */\n showCalendar?: boolean;\n /** Content rendered inside the calendar (dropdown on tablet/desktop, modal on mobile). */\n calendarContent?: ReactNode;\n /**\n * Optional controlled open state for the calendar.\n * When provided, the consumer is the source of truth; useful for closing\n * the calendar programmatically (e.g. on route change).\n */\n calendarOpen?: boolean;\n /** Fired whenever the calendar open state changes. */\n onCalendarOpenChange?: (open: boolean) => void;\n /** Show school/class/year inside the profile dropdown. */\n showProfileInfo?: boolean;\n /** Optional fallback image for the notifications empty state. */\n emptyNotificationsImage?: string;\n /** Empty-state title for notifications dropdown. */\n emptyNotificationsTitle?: string;\n /** Empty-state description for notifications dropdown. */\n emptyNotificationsDescription?: string;\n /** Callback fired when the user activates logout. */\n onLogout: () => void;\n /** Callback fired when the user activates the \"My data\" menu item. */\n onNavigateToMyData: () => void;\n /** Callback fired when the user clicks on a notification with entity info. */\n onNavigateByNotification?: (\n entityType?: NotificationEntityType,\n entityId?: string,\n entityStatus?: NotificationEntityStatus | null,\n questionId?: string | null\n ) => void;\n /**\n * Tailwind class overriding the default `max-w-[1000px]` of the header\n * content (forwarded to the internal `PageContainer`'s `innerClassName`).\n * Pass e.g. `max-w-[1350px]` to align the header with a widened page\n * content. When omitted, the default `max-w-[1000px]` is kept, so other\n * consumers are unaffected.\n */\n contentMaxWidth?: string;\n}\n\nconst DEFAULT_EMPTY_TITLE = 'Nenhuma notificação no momento';\nconst DEFAULT_EMPTY_DESCRIPTION =\n 'Você está em dia com todas as novidades. Volte depois para conferir atualizações!';\n\n/**\n * Application header shared across the analytica frontends.\n *\n * Renders the institution logo, optional calendar dropdown (mobile/tablet),\n * notifications center and a profile menu. Width is constrained by\n * `<PageContainer>` so it always aligns with the rest of the page content.\n */\nexport const AppHeader = ({\n user,\n sessionInfo,\n notifications,\n tutorial,\n showCalendar = false,\n calendarContent,\n calendarOpen,\n onCalendarOpenChange,\n showProfileInfo = false,\n emptyNotificationsImage,\n emptyNotificationsTitle = DEFAULT_EMPTY_TITLE,\n emptyNotificationsDescription = DEFAULT_EMPTY_DESCRIPTION,\n onLogout,\n onNavigateToMyData,\n onNavigateByNotification,\n contentMaxWidth,\n}: AppHeaderProps) => {\n const { isMobile, isExtraSmallMobile } = useMobile();\n const [activeStates, setActiveStates] = useState<Record<string, boolean>>({});\n\n useEffect(() => {\n notifications.fetchUnreadCount?.();\n }, []);\n\n const toggleActive = (buttonId: string) => {\n setActiveStates((prev) => {\n if (prev[buttonId]) {\n return { ...prev, [buttonId]: false };\n }\n return {\n calendar: false,\n notifications: false,\n profile: false,\n [buttonId]: true,\n };\n });\n };\n\n // Stable callback so `DropdownMenu`'s `useEffect [open, onOpenChange]`\n // doesn't re-fire on every parent re-render, which would cascade into a\n // Maximum-update-depth loop (same root cause class as PR #435).\n const handleCalendarOpenChange = useCallback(\n (open: boolean) => {\n setActiveStates((prev) => {\n const current = prev.calendar ?? false;\n if (current === open) {\n return prev;\n }\n if (open) {\n return {\n calendar: true,\n notifications: false,\n profile: false,\n };\n }\n return { ...prev, calendar: false };\n });\n onCalendarOpenChange?.(open);\n },\n [onCalendarOpenChange]\n );\n\n useEffect(() => {\n const handleEscapeKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setActiveStates({});\n }\n };\n document.addEventListener('keydown', handleEscapeKey);\n return () => document.removeEventListener('keydown', handleEscapeKey);\n }, []);\n\n const handleMyDataClick = () => {\n setActiveStates({});\n onNavigateToMyData();\n };\n\n const displayName = sessionInfo?.userName ?? user?.name ?? 'Usuário';\n const displayEmail = sessionInfo?.email ?? user?.email ?? '';\n\n const pickResponsiveClass = (\n extraSmall: string,\n mobile: string,\n desktop: string\n ): string => {\n if (isExtraSmallMobile) return extraSmall;\n if (isMobile) return mobile;\n return desktop;\n };\n const profileDropdownWidth = pickResponsiveClass(\n 'min-w-[260px]',\n 'min-w-[280px]',\n 'min-w-[320px]'\n );\n const sectionGap = pickResponsiveClass('gap-1', 'gap-2', 'gap-3');\n const logoHeight = pickResponsiveClass('h-6', 'h-8', 'h-10');\n const tutorialPadding = pickResponsiveClass(\n 'px-3 py-1.5 text-xs',\n 'px-3.5 py-2 text-sm',\n 'px-4 py-2 text-sm'\n );\n\n return (\n <header\n data-component=\"AppHeader\"\n className=\"bg-primary-800 w-full h-[70px] flex justify-center items-center\"\n >\n <PageContainer\n className=\"pb-0 justify-center\"\n innerClassName={contentMaxWidth}\n >\n <div className=\"w-full flex flex-row justify-between items-center gap-3\">\n {/* `min-w-0 shrink` lets the logo compress instead of overflowing:\n an <img> resolves `min-width:auto` to its intrinsic width, which\n would otherwise block flex-shrink and push the actions off-screen\n on narrow viewports. `object-left` keeps it left-aligned as it\n scales down. The actions never shrink. */}\n <BrandingLogo\n variant=\"main\"\n alt=\"Logo\"\n className={`${logoHeight} object-contain object-left min-w-0 shrink`}\n />\n <section\n className={`flex flex-row items-center shrink-0 ${sectionGap}`}\n >\n {tutorial?.visible && (\n <button\n type=\"button\"\n data-testid=\"app-header-tutorial\"\n onClick={tutorial.onClick}\n /* `primary` (não `text`) é o foreground de `primary-800` em\n todos os temas — os dois formam um par contrastante mesmo\n onde o dark inverte o header (paraiba/analytica). Usar\n `text-*` aqui inverteria com o modo enquanto o fundo do\n header não inverte, apagando o botão no dark. */\n className={`rounded-full border border-primary text-primary font-medium whitespace-nowrap cursor-pointer transition-colors hover:bg-primary-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${tutorialPadding}`}\n >\n {tutorial.label ?? 'Tutoriais'}\n </button>\n )}\n\n {showCalendar && (\n <div className=\"lg:hidden\">\n <CalendarCard\n content={calendarContent}\n isOpen={calendarOpen ?? activeStates.calendar ?? false}\n onOpenChange={handleCalendarOpenChange}\n />\n </div>\n )}\n\n <NotificationCard\n mode=\"center\"\n isActive={activeStates.notifications}\n onToggleActive={() => toggleActive('notifications')}\n onOpenChange={(open: boolean) => {\n syncDropdownState(\n open,\n activeStates.notifications,\n setActiveStates,\n 'notifications'\n );\n }}\n unreadCount={notifications.unreadCount}\n groupedNotifications={notifications.groupedNotifications}\n loading={notifications.loading}\n error={notifications.error}\n onRetry={notifications.refreshNotifications}\n onMarkAsReadById={notifications.markAsRead}\n onMarkAllAsRead={notifications.markAllAsRead}\n onDeleteById={notifications.deleteNotification}\n onNavigateById={(\n entityType,\n entityId,\n entityStatus,\n questionId\n ) => {\n if (entityType && entityId) {\n // Fecha o painel antes de navegar. Sem isso, quando o destino\n // é a própria página em que o usuário já está (ex.: ele\n // termina a atividade, cai no resultado, abre o sino e clica\n // em \"Ver resultado\" da notificação dessa mesma atividade),\n // o navigate para a rota atual não muda nada na tela, o\n // painel segue aberto e ele clica de novo — rage click\n // FRONTEND-ALUNO-WEB-F3, 91 ocorrências / 36 usuários em seis\n // semanas. Fechar o painel é o feedback visível que faltava,\n // e vale para qualquer destino.\n //\n // É um setState em handler de clique, não em render/efeito:\n // não reabre o loop do PR #435. E o onOpenChange que o\n // DropdownMenu dispara ao fechar vira no-op no\n // syncDropdownState, porque isActive já estará false.\n setActiveStates((prev) => ({\n ...prev,\n notifications: false,\n }));\n onNavigateByNotification?.(\n entityType,\n entityId,\n entityStatus,\n questionId\n );\n }\n }}\n getActionLabel={notifications.getActionLabel}\n onFetchNotifications={notifications.fetchNotifications}\n emptyStateImage={emptyNotificationsImage}\n emptyStateTitle={emptyNotificationsTitle}\n emptyStateDescription={emptyNotificationsDescription}\n />\n\n <DropdownMenu\n onOpenChange={(open: boolean) => {\n syncDropdownState(\n open,\n activeStates.profile,\n setActiveStates,\n 'profile'\n );\n }}\n >\n <DropdownMenuTrigger\n className=\"text-primary cursor-pointer\"\n asChild\n >\n <IconButton\n active={activeStates.profile}\n // O IconButton só tem ícone: sem rótulo próprio ele cai no\n // padrão \"Botão de ação\", que não diz o que abre.\n aria-label=\"Abrir menu de perfil\"\n onClick={() => toggleActive('profile')}\n icon={\n <UserIcon\n size={24}\n className={activeStates.profile ? 'opacity-80' : ''}\n />\n }\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className={profileDropdownWidth}\n side=\"bottom\"\n variant=\"profile\"\n align=\"end\"\n >\n <ProfileMenuHeader\n name={displayName}\n email={displayEmail}\n photoUrl={sessionInfo?.urlProfilePicture}\n />\n\n {showProfileInfo && (\n <ProfileMenuInfo\n schoolName={sessionInfo?.schoolName ?? ''}\n classYearName={sessionInfo?.className ?? ''}\n schoolYearName={sessionInfo?.schoolYearName ?? ''}\n />\n )}\n\n <ProfileMenuSection>\n <DropdownMenuItem\n variant=\"profile\"\n iconLeft={<UserPhosphorIcon />}\n iconRight={<CaretRightIcon />}\n onClick={handleMyDataClick}\n >\n <Text size=\"md\" color=\"text-text-700\">\n Meus dados\n </Text>\n </DropdownMenuItem>\n\n <ProfileToggleTheme />\n </ProfileMenuSection>\n\n <ProfileMenuFooter onClick={onLogout} />\n </DropdownMenuContent>\n </DropdownMenu>\n </section>\n </div>\n </PageContainer>\n </header>\n );\n};\n\nexport default AppHeader;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,sBAAsB;AAC/B,SAAS,YAAY,wBAAwB;AAyQnC,cA8IM,YA9IN;AAjIV,IAAM,sBAAsB;AAC5B,IAAM,4BACJ;AASK,IAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA,0BAA0B;AAAA,EAC1B,gCAAgC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,EAAE,UAAU,mBAAmB,IAAI,UAAU;AACnD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAkC,CAAC,CAAC;AAE5E,YAAU,MAAM;AACd,kBAAc,mBAAmB;AAAA,EACnC,GAAG,CAAC,CAAC;AAEL,QAAM,eAAe,CAAC,aAAqB;AACzC,oBAAgB,CAAC,SAAS;AACxB,UAAI,KAAK,QAAQ,GAAG;AAClB,eAAO,EAAE,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM;AAAA,MACtC;AACA,aAAO;AAAA,QACL,UAAU;AAAA,QACV,eAAe;AAAA,QACf,SAAS;AAAA,QACT,CAAC,QAAQ,GAAG;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH;AAKA,QAAM,2BAA2B;AAAA,IAC/B,CAAC,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;AAAA;AAAA,gCACF;AAAA,gCAEA,oBAAC,sBAAmB;AAAA,iCACtB;AAAA,8BAEA,oBAAC,qBAAkB,SAAS,UAAU;AAAA;AAAA;AAAA,wBACxC;AAAA;AAAA;AAAA,kBACF;AAAA;AAAA;AAAA,YACF;AAAA,aACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,oBAAQ;","names":[]}
|
|
@@ -348,17 +348,7 @@ function formatQuestionDuration(seconds) {
|
|
|
348
348
|
if (total <= 0) {
|
|
349
349
|
return null;
|
|
350
350
|
}
|
|
351
|
-
|
|
352
|
-
const minutes = Math.floor(total % 3600 / 60);
|
|
353
|
-
const secs = total % 60;
|
|
354
|
-
const paddedSeconds = String(secs).padStart(2, "0");
|
|
355
|
-
if (hours > 0) {
|
|
356
|
-
return `${hours}h${String(minutes).padStart(2, "0")}'${paddedSeconds}"`;
|
|
357
|
-
}
|
|
358
|
-
if (minutes > 0) {
|
|
359
|
-
return `${minutes}'${paddedSeconds}"`;
|
|
360
|
-
}
|
|
361
|
-
return `${secs}"`;
|
|
351
|
+
return formatTimeSpent(total);
|
|
362
352
|
}
|
|
363
353
|
|
|
364
354
|
// src/hooks/useSimulationCardDetails.ts
|
|
@@ -559,11 +549,8 @@ function SimulationQuestionItem({
|
|
|
559
549
|
const badge = getQuestionStatusBadgeConfig(
|
|
560
550
|
QUESTION_STATUS_MAP[question.status]
|
|
561
551
|
);
|
|
562
|
-
const label = [
|
|
563
|
-
|
|
564
|
-
question.subject,
|
|
565
|
-
formatQuestionDuration(question.timeSpent)
|
|
566
|
-
].filter(Boolean).join(" - ");
|
|
552
|
+
const label = [`Quest\xE3o ${index + 1}`, question.subject].filter(Boolean).join(" - ");
|
|
553
|
+
const duration = formatQuestionDuration(question.timeSpent);
|
|
567
554
|
const alternatives = question.options.map((option) => {
|
|
568
555
|
let status;
|
|
569
556
|
if (option.isCorrect) {
|
|
@@ -630,17 +617,27 @@ function SimulationQuestionItem({
|
|
|
630
617
|
value: question.questionId,
|
|
631
618
|
trigger: /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 items-center justify-between gap-3 py-3", children: [
|
|
632
619
|
/* @__PURE__ */ jsx2(Text_default, { size: "sm", weight: "bold", className: "min-w-0 text-text-950", children: label }),
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
"
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
620
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
621
|
+
duration && /* @__PURE__ */ jsx2(
|
|
622
|
+
Text_default,
|
|
623
|
+
{
|
|
624
|
+
size: "xs",
|
|
625
|
+
className: "whitespace-nowrap tabular-nums text-text-600",
|
|
626
|
+
children: duration
|
|
627
|
+
}
|
|
628
|
+
),
|
|
629
|
+
/* @__PURE__ */ jsx2(
|
|
630
|
+
"span",
|
|
631
|
+
{
|
|
632
|
+
className: cn(
|
|
633
|
+
"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium",
|
|
634
|
+
badge.bgColor,
|
|
635
|
+
badge.textColor
|
|
636
|
+
),
|
|
637
|
+
children: badge.label
|
|
638
|
+
}
|
|
639
|
+
)
|
|
640
|
+
] })
|
|
644
641
|
] }),
|
|
645
642
|
contentClassName: "px-3 pb-3",
|
|
646
643
|
children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -1086,4 +1083,4 @@ export {
|
|
|
1086
1083
|
SimulationAnswers,
|
|
1087
1084
|
SimulationsDetailModal
|
|
1088
1085
|
};
|
|
1089
|
-
//# sourceMappingURL=chunk-
|
|
1086
|
+
//# sourceMappingURL=chunk-CWGYVJTQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/SimulationsPage/SimulationsDetailModal.tsx","../src/components/shared/SimulationSummaryCards.tsx","../src/utils/simulatedScore.ts","../src/utils/questionDuration.ts","../src/hooks/useSimulationCardDetails.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport type { ChangeEvent } from 'react';\nimport { PaperclipIcon } from '@phosphor-icons/react/dist/csr/Paperclip';\nimport { XIcon } from '@phosphor-icons/react/dist/csr/X';\nimport Modal from '../Modal/Modal';\nimport Text from '../Text/Text';\nimport Button from '../Button/Button';\nimport TextArea from '../TextArea/TextArea';\nimport { CardAccordation } from '../Accordation';\nimport { SkeletonCard } from '../Skeleton/Skeleton';\nimport { QuestionCommentField } from '../shared/QuestionCommentField';\nimport {\n TrueFalseStatementList,\n type TrueFalseStatement,\n} from '../shared/TrueFalseStatementList';\nimport { ImageAnswerView } from '../shared/ImageAnswerView';\nimport { DEFAULT_IMAGE_TOLERANCE } from '../../utils/image/imageAnswer.utils';\nimport { AlternativesList } from '../Alternative/Alternative';\nimport { HtmlMathRenderer } from '../HtmlMathRenderer';\nimport { OptionStatus } from '../../enums/Options';\nimport { QUESTION_TYPE } from '../Quiz/useQuizStore';\nimport {\n getQuestionStatusBadgeConfig,\n QUESTION_STATUS,\n type QuestionStatus,\n} from '../../utils/studentActivityCorrection';\nimport {\n buildSimulationMeta,\n ContentCards,\n DataCard,\n SectionTitle,\n SimulationCardShell,\n SimulationStatCards,\n StudentSummaryHeader,\n} from '../shared/SimulationSummaryCards';\nimport { cn } from '../../utils/utils';\nimport { formatQuestionDuration } from '../../utils/questionDuration';\nimport { formatTimeSpent } from '../../utils/activityDetailsUtils';\nimport type { BaseApiClient } from '../../types/api';\nimport { createUseSimulations } from '../../hooks/useSimulations';\nimport {\n useSimulationCardDetails,\n type SimulationCardHandlers,\n type SimulationDetailState,\n type SimulationNoteState,\n} from '../../hooks/useSimulationCardDetails';\nimport type {\n SimulationsListData,\n SimulationDetailQuestion,\n StudentSimulationItem,\n NoteData,\n} from '../../types/simulations';\n\nexport interface SimulationsDetailModalProps {\n /** API client used to fetch the student's simulations */\n readonly api: BaseApiClient;\n readonly isOpen: boolean;\n readonly onClose: () => void;\n /** The student whose simulations are shown (null closes the modal) */\n readonly student: { userInstitutionId: string; name: string } | null;\n}\n\n/** Map the simulation question status to the shared correction status. */\nconst QUESTION_STATUS_MAP: Record<\n SimulationDetailQuestion['status'],\n QuestionStatus\n> = {\n CORRECT: QUESTION_STATUS.CORRETA,\n INCORRECT: QUESTION_STATUS.INCORRETA,\n BLANK: QUESTION_STATUS.EM_BRANCO,\n PENDING: QUESTION_STATUS.PENDENTE,\n};\n\n/** Label of the inner accordion holding the student's answer. */\nfunction getAnswerAccordionTitle(questionType: string): string {\n if (questionType === QUESTION_TYPE.DISSERTATIVA) {\n return 'Resposta do aluno';\n }\n if (questionType === QUESTION_TYPE.VERDADEIRO_FALSO) {\n return 'Afirmações';\n }\n if (questionType === QUESTION_TYPE.IMAGEM) {\n return 'Imagem';\n }\n return 'Alternativas';\n}\n\n// ---------------------------------------------------------------------------\n// Level 2 — Question (reuses the shared alternatives renderer + status badge)\n// ---------------------------------------------------------------------------\n\nexport interface SimulationQuestionItemProps {\n readonly question: SimulationDetailQuestion;\n /** Zero-based position in the simulation; shown as \"Questão N\". */\n readonly index: number;\n /** Persist the teacher comment on this question; an empty string clears it. */\n readonly onSaveComment: (comment: string) => Promise<void>;\n}\n\n/**\n * One question of a student's simulation: an accordion with the status badge\n * in its header and, inside, the statement, the student's answer (alternatives,\n * true/false marks, essay text or image click, by question type) and the\n * teacher comment field.\n *\n * Exported so consumers that list a student's simulations in their own layout\n * (the Desempenho report of the teacher app) render questions exactly as the\n * Simulados page does.\n */\nexport function SimulationQuestionItem({\n question,\n index,\n onSaveComment,\n}: SimulationQuestionItemProps) {\n const badge = getQuestionStatusBadgeConfig(\n QUESTION_STATUS_MAP[question.status]\n );\n\n // The subject only joins the label when the question has one mapped in the\n // knowledge matrix; without it the row falls back to a plain \"Questão N\".\n const label = [`Questão ${index + 1}`, question.subject]\n .filter(Boolean)\n .join(' - ');\n\n // Time spent sits on the right, next to the badge, and not glued to the\n // label: it is a measurement, read down the column against the other\n // questions, not part of the question's name. Null when it was never\n // measured, and then the row shows nothing rather than `00:00:00`.\n const duration = formatQuestionDuration(question.timeSpent);\n\n const alternatives = question.options.map((option) => {\n let status: OptionStatus;\n if (option.isCorrect) {\n status = OptionStatus.CORRECT;\n } else if (option.isSelected) {\n status = OptionStatus.INCORRECT;\n } else {\n status = OptionStatus.NEUTRAL;\n }\n return { label: option.option, value: option.id, status };\n });\n\n // An essay has no alternatives to show — it has the text the student wrote.\n // Rendering the \"Alternativas\" accordion for it produced an empty box and hid\n // the answer entirely, leaving the teacher to comment on nothing.\n const isEssay = question.questionType === QUESTION_TYPE.DISSERTATIVA;\n\n // True/false never writes `option_id`, so `isSelected` is always false and the\n // student's marks live in each option's `selectedValue`. Sending it through\n // the alternatives branch showed the answer key as if it were the student's\n // answer, and no mark at all.\n const isTrueFalse = question.questionType === QUESTION_TYPE.VERDADEIRO_FALSO;\n const trueFalseStatements: TrueFalseStatement[] = question.options.map(\n (option) => ({\n id: option.id,\n statement: option.option,\n studentMark: option.selectedValue ?? null,\n isTrue: option.isCorrect,\n })\n );\n\n // IMAGEM has no alternatives either: the answer is a point on an image. The\n // alternatives branch rendered the answer key's raw JSON as an option label,\n // painted green, and never showed where the student clicked.\n const isImage = question.questionType === QUESTION_TYPE.IMAGEM;\n\n /**\n * Render the student's answer, shaped by the question type.\n */\n const renderAnswerArea = () => {\n if (isImage) {\n return (\n <ImageAnswerView\n imageUrl={question.additionalContent ?? ''}\n correctPoint={question.correctPoint}\n studentPoint={\n question.imageAnswer\n ? {\n x: question.imageAnswer.coordinateX,\n y: question.imageAnswer.coordinateY,\n }\n : null\n }\n toleranceRadius={question.imageTolerance ?? DEFAULT_IMAGE_TOLERANCE}\n />\n );\n }\n\n if (isEssay) {\n return (\n <div className=\"rounded-lg border border-border-100 bg-background-50 p-3\">\n {question.answer ? (\n <HtmlMathRenderer\n content={question.answer}\n className=\"text-sm text-text-800\"\n />\n ) : (\n <Text size=\"sm\" className=\"text-text-600\">\n Nenhuma resposta fornecida\n </Text>\n )}\n </div>\n );\n }\n\n if (isTrueFalse) {\n return <TrueFalseStatementList statements={trueFalseStatements} />;\n }\n\n return (\n <AlternativesList\n mode=\"readonly\"\n layout=\"compact\"\n name={`question-${question.questionId}`}\n alternatives={alternatives}\n selectedValue={question.selectedOptionId ?? ''}\n />\n );\n };\n\n return (\n <CardAccordation\n value={question.questionId}\n trigger={\n <div className=\"flex flex-1 items-center justify-between gap-3 py-3\">\n <Text size=\"sm\" weight=\"bold\" className=\"min-w-0 text-text-950\">\n {label}\n </Text>\n <div className=\"flex shrink-0 items-center gap-2\">\n {duration && (\n <Text\n size=\"xs\"\n className=\"whitespace-nowrap tabular-nums text-text-600\"\n >\n {duration}\n </Text>\n )}\n <span\n className={cn(\n 'inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium',\n badge.bgColor,\n badge.textColor\n )}\n >\n {badge.label}\n </span>\n </div>\n </div>\n }\n contentClassName=\"px-3 pb-3\"\n >\n <div className=\"flex flex-col gap-3\">\n <HtmlMathRenderer\n content={question.statement}\n className=\"text-sm text-text-800\"\n />\n <CardAccordation\n value={`${question.questionId}-answer`}\n trigger={\n <div className=\"flex-1 py-2\">\n <Text size=\"sm\" weight=\"medium\" className=\"text-text-950\">\n {getAnswerAccordionTitle(question.questionType)}\n </Text>\n </div>\n }\n contentClassName=\"px-3 pb-3\"\n >\n {renderAnswerArea()}\n </CardAccordation>\n <QuestionCommentField\n value={question.teacherComment ?? ''}\n onSave={onSaveComment}\n />\n </div>\n </CardAccordation>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Note (\"Observação\")\n// ---------------------------------------------------------------------------\n\nexport interface SimulationNoteRowProps {\n /** Current observation, null when the teacher never wrote one. */\n readonly note: NoteData | null;\n readonly loading: boolean;\n /**\n * Message of a failed load. While it is set the row offers a retry instead\n * of the editor: writing over a note that could not be read would replace\n * it, and this save has no version to protect it.\n */\n readonly loadError?: string | null;\n /** Load the observation again; required whenever `loadError` can be set. */\n readonly onRetry?: () => void;\n /**\n * Persist the observation. `text` is already trimmed and non-empty; `file`\n * is a newly chosen attachment still to be uploaded (null when none), and\n * `existingAttachment` is the URL of the saved file the teacher kept — null\n * when there was none, when it was removed, or when a new file replaces it.\n */\n readonly onSave: (\n text: string,\n file: File | null,\n existingAttachment: string | null\n ) => Promise<void>;\n}\n\n/**\n * Human label of an attachment URL: its file name, or a generic word when the\n * URL carries none.\n */\nfunction getAttachmentLabel(url: string): string {\n const lastSegment = url.split('?')[0].split('/').pop() ?? '';\n try {\n return decodeURIComponent(lastSegment) || 'Anexo';\n } catch {\n return lastSegment || 'Anexo';\n }\n}\n\n/**\n * Grey pill naming an attached file. Links to the file when `href` is given\n * and offers a remove button when `onRemove` is given — the same chip the\n * activity correction modal uses for its observation attachment.\n */\nfunction AttachmentChip({\n label,\n href,\n onRemove,\n}: {\n readonly label: string;\n readonly href?: string;\n readonly onRemove?: () => void;\n}) {\n const content = (\n <>\n <PaperclipIcon size={18} className=\"shrink-0 text-text-800\" />\n <span className=\"truncate text-md font-medium text-text-800\">\n {label}\n </span>\n </>\n );\n\n return (\n <div className=\"flex h-10 min-w-0 max-w-[220px] items-center gap-2 rounded-full bg-secondary-500 px-5\">\n {href ? (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex min-w-0 items-center gap-2 hover:underline\"\n >\n {content}\n </a>\n ) : (\n content\n )}\n {onRemove && (\n <button\n type=\"button\"\n onClick={onRemove}\n className=\"shrink-0 text-text-700 hover:text-text-950\"\n aria-label={`Remover ${label}`}\n >\n <XIcon size={18} />\n </button>\n )}\n </div>\n );\n}\n\n/**\n * The simulation-wide teacher observation: a row with the saved text, the\n * attached file (if any) and an \"Incluir\"/\"Editar\" button that swaps into a\n * textarea with \"Anexar\" and \"Salvar\" — the same flow as the observation of\n * the activity correction modal.\n *\n * Exported for the same reason as {@link SimulationQuestionItem}.\n */\nexport function SimulationNoteRow({\n note,\n loading,\n loadError,\n onRetry,\n onSave,\n}: SimulationNoteRowProps) {\n const [editing, setEditing] = useState(false);\n const [draft, setDraft] = useState('');\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n /** File chosen in this editing session, not uploaded yet. */\n const [pendingFile, setPendingFile] = useState<File | null>(null);\n /** Saved attachment the teacher is keeping; null once removed. */\n const [keptAttachment, setKeptAttachment] = useState<string | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const savedAttachment = note?.attachment ?? null;\n\n const startEditing = () => {\n setDraft(note?.note ?? '');\n setPendingFile(null);\n setKeptAttachment(savedAttachment);\n setError(null);\n setEditing(true);\n };\n\n const handleFileChange = (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0] ?? null;\n if (file) setPendingFile(file);\n // Reset so the same file can be picked again after being removed.\n event.target.value = '';\n };\n\n const handleSave = async () => {\n if (!draft.trim()) return;\n setSaving(true);\n setError(null);\n try {\n await onSave(\n draft.trim(),\n pendingFile,\n pendingFile ? null : keptAttachment\n );\n setEditing(false);\n } catch {\n // Keep the editing UI open (draft preserved) and surface the failure.\n setError('Erro ao salvar a observação. Tente novamente.');\n } finally {\n setSaving(false);\n }\n };\n\n /** Left side of the footer: the chosen/kept file, or the \"Anexar\" button. */\n const renderAttachmentControl = () => {\n if (pendingFile) {\n return (\n <AttachmentChip\n label={pendingFile.name}\n onRemove={() => setPendingFile(null)}\n />\n );\n }\n if (keptAttachment) {\n return (\n <AttachmentChip\n label={getAttachmentLabel(keptAttachment)}\n href={keptAttachment}\n onRemove={() => setKeptAttachment(null)}\n />\n );\n }\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"medium\"\n onClick={() => fileInputRef.current?.click()}\n className=\"flex items-center gap-2\"\n >\n <PaperclipIcon size={18} />\n Anexar\n </Button>\n );\n };\n\n if (loading) {\n return <SkeletonCard className=\"h-14\" />;\n }\n\n if (loadError) {\n return (\n <div className=\"flex items-center justify-between gap-2 rounded-lg border border-border-200 bg-background p-4\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <Text size=\"md\" weight=\"bold\" className=\"text-text-950\">\n Observação\n </Text>\n <Text size=\"sm\" className=\"text-error-600\">\n {loadError}\n </Text>\n </div>\n {onRetry && (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"medium\"\n onClick={onRetry}\n className=\"shrink-0\"\n >\n Tentar novamente\n </Button>\n )}\n </div>\n );\n }\n\n if (editing) {\n return (\n <div className=\"flex flex-col gap-4 rounded-lg border border-border-200 bg-background p-4\">\n <Text size=\"md\" weight=\"bold\" className=\"text-text-950\">\n Observação\n </Text>\n <TextArea\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n placeholder=\"Escreva uma observação para este simulado\"\n rows={3}\n />\n {error && (\n <Text size=\"sm\" className=\"text-error-600\">\n {error}\n </Text>\n )}\n {/* Only images: the pre-signed upload endpoint accepts nothing else. */}\n <input\n type=\"file\"\n ref={fileInputRef}\n className=\"hidden\"\n accept=\"image/*\"\n onChange={handleFileChange}\n aria-label=\"Selecionar arquivo\"\n />\n <div className=\"flex flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between\">\n {renderAttachmentControl()}\n <Button\n type=\"button\"\n variant=\"solid\"\n size=\"medium\"\n onClick={handleSave}\n disabled={saving || !draft.trim()}\n >\n Salvar\n </Button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex items-center justify-between gap-2 rounded-lg border border-border-200 bg-background p-4\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <Text size=\"md\" weight=\"bold\" className=\"text-text-950\">\n Observação\n </Text>\n {note?.note && (\n <Text size=\"sm\" className=\"truncate text-text-700\">\n {note.note}\n </Text>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {savedAttachment && (\n <AttachmentChip\n label={getAttachmentLabel(savedAttachment)}\n href={savedAttachment}\n />\n )}\n <Button\n type=\"button\"\n variant=\"solid\"\n size=\"medium\"\n onClick={startEditing}\n >\n {note?.note ? 'Editar' : 'Incluir'}\n </Button>\n </div>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Level 1 — Simulation\n// ---------------------------------------------------------------------------\n\n/**\n * Observation and question list of one simulado, loaded when its card is\n * first expanded.\n */\nexport function SimulationAnswers({\n detail,\n note,\n onRetryNote,\n onSaveNote,\n onSaveQuestionComment,\n}: {\n readonly detail: SimulationDetailState | undefined;\n readonly note: SimulationNoteState | undefined;\n /** Load the observation again after a failed request */\n readonly onRetryNote: () => void;\n readonly onSaveNote: SimulationNoteRowProps['onSave'];\n readonly onSaveQuestionComment: (\n questionId: string,\n comment: string\n ) => Promise<void>;\n}) {\n if (!detail || detail.loading) {\n return <SkeletonCard className=\"h-40\" />;\n }\n\n if (detail.error) {\n return (\n <Text size=\"sm\" className=\"text-error-600\">\n {detail.error}\n </Text>\n );\n }\n\n if (!detail.data) return null;\n\n return (\n <>\n <SimulationNoteRow\n note={note?.data ?? null}\n loading={note?.loading ?? false}\n loadError={note?.error ?? null}\n onRetry={onRetryNote}\n onSave={onSaveNote}\n />\n\n <div className=\"flex flex-col gap-2 pt-2\">\n <Text as=\"h4\" size=\"lg\" weight=\"bold\" className=\"text-text-950\">\n Respostas\n </Text>\n {detail.data.questions.map((question, qIndex) => (\n <SimulationQuestionItem\n key={question.questionId}\n question={question}\n index={qIndex}\n onSaveComment={(comment) =>\n onSaveQuestionComment(question.questionId, comment)\n }\n />\n ))}\n </div>\n </>\n );\n}\n\nfunction SimulationItem({\n simulation,\n index,\n expanded,\n onToggle,\n detail,\n note,\n onRetryNote,\n onSaveNote,\n onSaveQuestionComment,\n}: SimulationCardHandlers & {\n readonly simulation: StudentSimulationItem;\n readonly index: number;\n readonly expanded: boolean;\n readonly onToggle: () => void;\n}) {\n const title = simulation.title?.trim()\n ? simulation.title.trim()\n : `Simulado ${index + 1}`;\n const meta = buildSimulationMeta(simulation);\n\n return (\n <SimulationCardShell\n value={simulation.id}\n title={title}\n meta={meta}\n correct={simulation.correctCount}\n totalQuestions={simulation.totalQuestions}\n expanded={expanded}\n onToggle={onToggle}\n >\n <SimulationStatCards\n score={simulation.score}\n correct={simulation.correctCount}\n incorrect={simulation.incorrectCount}\n blank={simulation.blankCount}\n />\n {/* Essays awaiting grading used to be counted as blank. */}\n {detail?.data && detail.data.counts.pending > 0 && (\n <Text size=\"sm\" className=\"text-text-600\">\n {`${detail.data.counts.pending} ${detail.data.counts.pending === 1 ? 'questão dissertativa aguarda' : 'questões dissertativas aguardam'} correção`}\n </Text>\n )}\n <ContentCards\n best={simulation.bestContent ?? null}\n worst={simulation.worstContent ?? null}\n />\n {expanded && (\n <SimulationAnswers\n detail={detail}\n note={note}\n onRetryNote={onRetryNote}\n onSaveNote={onSaveNote}\n onSaveQuestionComment={onSaveQuestionComment}\n />\n )}\n </SimulationCardShell>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Modal\n// ---------------------------------------------------------------------------\n\n/**\n * Modal that shows a single student's answered simulations as a nested\n * accordion (simulation -> question -> options), lazily loading each\n * simulation's detail when it is expanded. Reuses the shared StatCard and\n * AlternativesList components so the detail matches the activity correction UI.\n */\nexport function SimulationsDetailModal({\n api,\n isOpen,\n onClose,\n student,\n}: SimulationsDetailModalProps) {\n const useSimulations = useMemo(() => createUseSimulations(api), [api]);\n const { fetchStudentSimulations } = useSimulations();\n\n const [list, setList] = useState<SimulationsListData | null>(null);\n const [listLoading, setListLoading] = useState(false);\n const [listError, setListError] = useState<string | null>(null);\n\n const {\n expandedId,\n details,\n notes,\n toggle,\n retryNote,\n makeSaveNote,\n makeSaveQuestionComment,\n } = useSimulationCardDetails({\n api,\n userInstitutionId: student?.userInstitutionId ?? null,\n isOpen,\n });\n\n useEffect(() => {\n if (!isOpen || !student) return;\n\n setList(null);\n setListLoading(true);\n setListError(null);\n\n let active = true;\n fetchStudentSimulations(student.userInstitutionId)\n .then((data) => {\n if (active) setList(data);\n })\n .catch(() => {\n if (active) setListError('Erro ao carregar os simulados do estudante');\n })\n .finally(() => {\n if (active) setListLoading(false);\n });\n\n return () => {\n active = false;\n };\n }, [isOpen, student, fetchStudentSimulations]);\n\n return (\n <Modal isOpen={isOpen} onClose={onClose} title=\"Simulados\" size=\"xl\">\n {student && (\n <div className=\"flex max-h-[70vh] flex-col gap-6 overflow-y-auto pr-1\">\n <StudentSummaryHeader\n name={student.name}\n location={[\n list?.student.school,\n list?.student.class,\n list?.student.schoolYear,\n ]}\n />\n\n {listLoading && (\n <>\n <SkeletonCard className=\"h-20\" />\n <SkeletonCard className=\"h-40\" />\n </>\n )}\n {listError && (\n <Text size=\"sm\" className=\"text-error-600\">\n {listError}\n </Text>\n )}\n\n {list && (\n <section className=\"flex flex-col gap-3\">\n <SectionTitle>Dados de simulados</SectionTitle>\n <div className=\"flex flex-col gap-2 md:flex-row\">\n <DataCard\n label=\"Simulados realizados\"\n value={String(list.student.simulationsAnswered)}\n />\n {list.student.totalTimeSeconds !== undefined && (\n <DataCard\n label=\"Tempo total\"\n value={formatTimeSpent(list.student.totalTimeSeconds)}\n />\n )}\n </div>\n </section>\n )}\n\n {list && (\n <section className=\"flex flex-col gap-3\">\n <SectionTitle>Simulados realizados</SectionTitle>\n {list.simulations.data.length === 0 ? (\n <div className=\"flex items-center justify-center rounded-xl border border-border-50 bg-background p-6\">\n <Text size=\"sm\" className=\"text-text-600\">\n Este estudante ainda não respondeu nenhum simulado.\n </Text>\n </div>\n ) : (\n <div className=\"flex flex-col gap-2\">\n {list.simulations.data.map((simulation, index) => (\n <SimulationItem\n // Keyed by the student too: the comment fields below keep\n // a dirty draft through a `value` change so an in-flight\n // save cannot discard it, and a note written for one\n // student must never survive into another. Remounting\n // resets it for free.\n key={`${student.userInstitutionId}-${simulation.id}`}\n simulation={simulation}\n index={index}\n expanded={expandedId === simulation.id}\n onToggle={() => toggle(simulation.id)}\n detail={details[simulation.id]}\n note={notes[simulation.id]}\n onRetryNote={() => retryNote(simulation.id)}\n onSaveNote={makeSaveNote(simulation.id)}\n onSaveQuestionComment={makeSaveQuestionComment(\n simulation.id\n )}\n />\n ))}\n </div>\n )}\n </section>\n )}\n </div>\n )}\n </Modal>\n );\n}\n","import type { ReactNode } from 'react';\nimport { ExamIcon } from '@phosphor-icons/react/dist/csr/Exam';\nimport { CheckCircleIcon } from '@phosphor-icons/react/dist/csr/CheckCircle';\nimport { XCircleIcon } from '@phosphor-icons/react/dist/csr/XCircle';\nimport { MinusCircleIcon } from '@phosphor-icons/react/dist/csr/MinusCircle';\nimport Text from '../Text/Text';\nimport ProgressBar from '../ProgressBar/ProgressBar';\nimport { CardAccordation } from '../Accordation';\nimport { UserIcon } from '../UserIcon/UserIcon';\nimport { cn } from '../../utils/utils';\nimport { formatScoreOutOfTen } from '../../utils/simulatedScore';\nimport {\n formatDateToBrazilian,\n formatTimeSpent,\n} from '../../utils/activityDetailsUtils';\n\n/**\n * Summary blocks of a student's simulados: header, \"Dados de simulados\" cards,\n * the coloured stat cards and the best/worst subtema pair.\n *\n * Shared by the two modals that show them — the Simulados page modal and the\n * Simulados report modal — so the design is described once. Everything here is\n * presentational: it takes already-fetched numbers and returns markup.\n */\n\n/**\n * The only field these cards read from a subtema, so both the Simulados page\n * shape and the report shape satisfy it.\n */\nexport interface SimulationContentSummary {\n readonly contentName: string;\n}\n\n/** The fields the \"Duração · Nota · Feito em\" line reads from a simulado. */\nexport interface SimulationMetaSource {\n readonly timeSpentSeconds?: number;\n readonly score?: number;\n readonly answeredAt?: string | null;\n}\n\n/**\n * \"Duração · Nota · Feito em\" line of a simulado card. Each segment only joins\n * when its field came in the payload, so an older backend shows a shorter line\n * instead of \"undefined\".\n */\nexport function buildSimulationMeta(simulation: SimulationMetaSource): string {\n const parts: string[] = [];\n if (simulation.timeSpentSeconds !== undefined) {\n parts.push(`Duração: ${formatTimeSpent(simulation.timeSpentSeconds)}`);\n }\n if (simulation.score !== undefined) {\n parts.push(`Nota: ${formatScoreOutOfTen(simulation.score)}`);\n }\n if (simulation.answeredAt) {\n parts.push(`Feito em: ${formatDateToBrazilian(simulation.answeredAt)}`);\n }\n return parts.join(' · ');\n}\n\n/** Section heading, \"Dados de simulados\" and its siblings (14px bold). */\nexport function SectionTitle({ children }: { readonly children: ReactNode }) {\n return (\n <Text as=\"h3\" size=\"sm\" weight=\"bold\" className=\"text-text-950\">\n {children}\n </Text>\n );\n}\n\n/**\n * White card with a centred uppercase label and the value in a rectangular\n * info badge: the \"Dados de simulados\" pair.\n */\nexport function DataCard({\n label,\n value,\n}: {\n readonly label: string;\n readonly value: string;\n}) {\n return (\n <div className=\"flex flex-1 flex-col items-center gap-2 rounded-xl border border-border-50 bg-background px-3 py-4\">\n <Text\n size=\"2xs\"\n weight=\"medium\"\n className=\"text-center uppercase text-text-800\"\n >\n {label}\n </Text>\n <span className=\"rounded-sm bg-info-background px-2 py-1 text-sm text-info-800\">\n {value}\n </span>\n </div>\n );\n}\n\n/** Tone of a coloured stat card; each maps to one token family. */\ntype StatTone = 'grade' | 'correct' | 'incorrect' | 'blank';\n\nconst STAT_TONE_CLASSES: Record<\n StatTone,\n { card: string; circle: string; icon: string; value: string }\n> = {\n grade: {\n card: 'bg-warning-background',\n circle: 'bg-warning-300',\n icon: 'text-text',\n value: 'text-warning-600',\n },\n correct: {\n card: 'bg-success-200',\n circle: 'bg-indicator-positive',\n icon: 'text-text-950',\n value: 'text-success-700',\n },\n incorrect: {\n card: 'bg-error-100',\n circle: 'bg-error-500',\n icon: 'text-text',\n value: 'text-error-700',\n },\n blank: {\n card: 'bg-info-background',\n circle: 'bg-info-500',\n icon: 'text-text',\n value: 'text-info-700',\n },\n};\n\n/**\n * Coloured stat card, laid out as a centred column: icon in a circle, tiny\n * uppercase label and the large value.\n */\nfunction SimulationStatCard({\n tone,\n icon,\n label,\n value,\n}: {\n readonly tone: StatTone;\n readonly icon: ReactNode;\n readonly label: string;\n readonly value: string;\n}) {\n const classes = STAT_TONE_CLASSES[tone];\n return (\n <div\n className={cn(\n 'flex flex-1 flex-col items-center gap-1 rounded-xl border border-border-50 px-3 py-4',\n classes.card\n )}\n >\n <span\n className={cn(\n 'flex size-8 shrink-0 items-center justify-center rounded-full',\n classes.circle,\n classes.icon\n )}\n >\n {icon}\n </span>\n <Text\n as=\"span\"\n weight=\"bold\"\n className=\"text-center text-[8px] leading-3 uppercase text-text-800\"\n >\n {label}\n </Text>\n <Text\n size=\"xl\"\n weight=\"bold\"\n className={cn('text-center', classes.value)}\n >\n {value}\n </Text>\n </div>\n );\n}\n\n/**\n * The four cards of a cut: grade, correct, incorrect and blank. The grade card\n * is skipped when no score was sent, so an older API still renders the three\n * counts it always had.\n */\nexport function SimulationStatCards({\n score,\n correct,\n incorrect,\n blank,\n}: {\n readonly score: number | undefined;\n readonly correct: number;\n readonly incorrect: number;\n readonly blank: number;\n}) {\n return (\n <div className=\"grid grid-cols-2 gap-2 lg:grid-cols-4\">\n {score !== undefined && (\n <SimulationStatCard\n tone=\"grade\"\n icon={<ExamIcon size={16} weight=\"bold\" />}\n label=\"Nota média\"\n value={formatScoreOutOfTen(score)}\n />\n )}\n <SimulationStatCard\n tone=\"correct\"\n icon={<CheckCircleIcon size={16} weight=\"bold\" />}\n label=\"Nº de questões corretas\"\n value={String(correct)}\n />\n <SimulationStatCard\n tone=\"incorrect\"\n icon={<XCircleIcon size={16} weight=\"bold\" />}\n label=\"Nº de questões incorretas\"\n value={String(incorrect)}\n />\n <SimulationStatCard\n tone=\"blank\"\n icon={<MinusCircleIcon size={16} weight=\"bold\" />}\n label=\"Nº de questões em branco\"\n value={String(blank)}\n />\n </div>\n );\n}\n\n/** One subtema card: centred coloured label over the content name. */\nfunction ContentCard({\n label,\n labelClassName,\n content,\n}: {\n readonly label: string;\n readonly labelClassName: string;\n readonly content: SimulationContentSummary | null;\n}) {\n return (\n <div className=\"flex flex-1 flex-col items-center gap-2 rounded-xl border border-border-50 bg-background p-4\">\n <Text\n size=\"2xs\"\n weight=\"medium\"\n className={cn('text-center uppercase', labelClassName)}\n >\n {label}\n </Text>\n <Text size=\"md\" className=\"text-center text-text-950\">\n {content?.contentName ?? '—'}\n </Text>\n </div>\n );\n}\n\n/** Best/worst subtema pair; \"—\" when the cut has no answered content. */\nexport function ContentCards({\n best,\n worst,\n}: {\n readonly best: SimulationContentSummary | null;\n readonly worst: SimulationContentSummary | null;\n}) {\n return (\n <div className=\"grid grid-cols-1 gap-2 md:grid-cols-2\">\n <ContentCard\n label=\"Subtema com melhor resultado\"\n labelClassName=\"text-success-300\"\n content={best}\n />\n <ContentCard\n label=\"Subtema com maior dificuldade\"\n labelClassName=\"text-error-300\"\n content={worst}\n />\n </div>\n );\n}\n\n/**\n * Expandable card of one simulado: title and meta line on top, the hit\n * progress below, and whatever the caller renders inside.\n *\n * The two modals list simulados from different endpoints, with different field\n * names, but the card itself is the same object on screen — so the shape lives\n * here and each caller passes the values it has.\n */\nexport function SimulationCardShell({\n value,\n title,\n meta,\n correct,\n totalQuestions,\n expanded,\n onToggle,\n children,\n}: {\n /** Accordion id, unique within the list */\n readonly value: string;\n readonly title: string;\n /** \"Duração · Nota · Feito em\"; an empty string hides the line */\n readonly meta: string;\n readonly correct: number;\n readonly totalQuestions: number;\n readonly expanded: boolean;\n readonly onToggle: () => void;\n readonly children: ReactNode;\n}) {\n return (\n <CardAccordation\n value={value}\n expanded={expanded}\n onToggleExpanded={onToggle}\n triggerClassName=\"p-4\"\n contentClassName=\"flex flex-col gap-4 pt-0\"\n trigger={\n <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n <div className=\"flex items-center justify-between gap-3\">\n <Text size=\"lg\" weight=\"bold\" className=\"min-w-0 text-text-950\">\n {title}\n </Text>\n {meta && (\n <Text\n size=\"xs\"\n weight=\"semibold\"\n className=\"shrink-0 text-text-600\"\n >\n {meta}\n </Text>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n <ProgressBar\n value={correct}\n max={totalQuestions}\n variant=\"green\"\n size=\"small\"\n className=\"flex-1\"\n />\n <Text size=\"xs\" weight=\"medium\" className=\"shrink-0 text-text-950\">\n {`${correct} de ${totalQuestions} corretas`}\n </Text>\n </div>\n </div>\n }\n >\n {children}\n </CardAccordation>\n );\n}\n\n/**\n * Header: avatar, name, an optional badge and \"Escola • Turma • Ano\".\n *\n * `location` takes the parts in display order and drops the empty ones, so a\n * caller whose payload has not arrived yet simply shows the name alone.\n */\nexport function StudentSummaryHeader({\n name,\n location,\n badge,\n}: {\n readonly name: string;\n readonly location: readonly (string | null | undefined)[];\n readonly badge?: ReactNode;\n}) {\n const parts = location.filter((part): part is string => Boolean(part));\n\n return (\n <div className=\"flex flex-col gap-2 border-b border-border-200 pb-4\">\n <div className=\"flex items-center gap-2\">\n <UserIcon size={24} className=\"shrink-0\" />\n <Text size=\"md\" className=\"min-w-0 flex-1 truncate text-text-950\">\n {name}\n </Text>\n {badge}\n </div>\n {parts.length > 0 && (\n <div className=\"flex flex-wrap items-center gap-2\">\n {parts.map((part, index) => (\n <span key={part} className=\"flex items-center gap-2\">\n {index > 0 && (\n <span\n aria-hidden=\"true\"\n className=\"size-1 rounded-full bg-border-600\"\n />\n )}\n <Text size=\"xs\" className=\"text-text-600\">\n {part}\n </Text>\n </span>\n ))}\n </div>\n )}\n </div>\n );\n}\n","/**\n * Format a 0-100 score as a 0-10 grade with one decimal, in pt-BR.\n *\n * The simulados stack carries scores as percentages, while every screen shows\n * them as a grade out of ten. Keeping the conversion in one place is what stops\n * the modal, the table and the cards from rounding differently.\n *\n * @param percentage - Score in the 0-100 scale\n * @returns The grade as a pt-BR string, e.g. `'7,1'`\n *\n * @example\n * ```typescript\n * formatScoreOutOfTen(71.25); // '7,1'\n * formatScoreOutOfTen(100); // '10,0'\n * ```\n */\nexport function formatScoreOutOfTen(percentage: number): string {\n return (percentage / 10).toLocaleString('pt-BR', {\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n });\n}\n","import { formatTimeSpent } from './activityDetailsUtils';\n\n/**\n * Format the time a student spent on a single question, the way the relatórios\n * of simulados present it: `HH:MM:SS` (`00:00:40`, `00:02:30`, `01:05:30`).\n *\n * The clock format is shared with `formatTimeSpent`, which renders the activity\n * and simulado totals — a question row and the \"Tempo total\" card above it read\n * the same way instead of each inventing its own notation.\n *\n * What this adds on top is the \"not measured\" rule: it returns `null` when\n * there is nothing meaningful to show — the value is zero, absent, negative or\n * not finite. Zero is not the same as \"answered instantly\": simulations\n * answered before per-question telemetry existed carry a zero, and so does a\n * question the student never opened. Rendering `00:00:00` there would read as\n * \"the student guessed\", which is the opposite of what the teacher should\n * conclude. Callers drop the whole segment from the row instead.\n *\n * @param seconds - Time spent in seconds\n * @returns Formatted duration in `HH:MM:SS`, or null when there is no measured time\n *\n * @example\n * ```typescript\n * formatQuestionDuration(150); // \"00:02:30\"\n * formatQuestionDuration(0); // null\n * ```\n */\nexport function formatQuestionDuration(\n seconds: number | null | undefined\n): string | null {\n if (seconds === null || seconds === undefined || !Number.isFinite(seconds)) {\n return null;\n }\n\n // Truncate before the zero check, not after: a fractional value below one\n // second floors to 0 and must take the same \"not measured\" path as a plain\n // 0, otherwise it would render a misleading `00:00:00`.\n const total = Math.floor(seconds);\n if (total <= 0) {\n return null;\n }\n\n return formatTimeSpent(total);\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type { BaseApiClient } from '../types/api';\nimport type { NoteData, SimulationDetailData } from '../types/simulations';\nimport { createUseSimulations } from './useSimulations';\n\n/** Lazily loaded question detail of one simulado. */\nexport interface SimulationDetailState {\n readonly loading: boolean;\n readonly error: string | null;\n readonly data: SimulationDetailData | null;\n}\n\n/**\n * Lazily loaded teacher observation of one simulado.\n *\n * `error` exists so a failed request is never shown as \"this simulado has no\n * observation\": that would offer the teacher an empty field whose save is a\n * create-or-replace, silently overwriting a note they were never shown.\n */\nexport interface SimulationNoteState {\n readonly loading: boolean;\n readonly error: string | null;\n readonly data: NoteData | null;\n}\n\n/** Save handler of one simulado's observation, as the note row expects it. */\nexport type SaveSimulationNote = (\n text: string,\n file: File | null,\n existingAttachment: string | null\n) => Promise<void>;\n\n/**\n * What one simulado card needs from this hook: the two loaded pieces and the\n * three actions on them, already bound to that simulado.\n */\nexport interface SimulationCardHandlers {\n readonly detail: SimulationDetailState | undefined;\n readonly note: SimulationNoteState | undefined;\n /** Load the observation again after a failed request */\n readonly onRetryNote: () => void;\n readonly onSaveNote: SaveSimulationNote;\n readonly onSaveQuestionComment: (\n questionId: string,\n comment: string\n ) => Promise<void>;\n}\n\nexport interface UseSimulationCardDetailsParams {\n /** API client used to load and save the per-simulado data */\n readonly api: BaseApiClient;\n /** Enrollment whose simulados are listed; null while there is no student */\n readonly userInstitutionId: string | null;\n /** Whether the modal is open; reopening starts a fresh session */\n readonly isOpen: boolean;\n}\n\nexport interface UseSimulationCardDetailsReturn {\n readonly expandedId: string | null;\n readonly details: Record<string, SimulationDetailState>;\n readonly notes: Record<string, SimulationNoteState>;\n /** Expand or collapse one simulado, loading its data the first time */\n readonly toggle: (simulationId: string) => void;\n /** Load the observation again after a failed request */\n readonly retryNote: (simulationId: string) => void;\n readonly makeSaveNote: (simulationId: string) => SaveSimulationNote;\n readonly makeSaveQuestionComment: (\n simulationId: string\n ) => (questionId: string, comment: string) => Promise<void>;\n}\n\n/**\n * Per-simulado detail state of a student's simulados modal.\n *\n * Owns what both modals that list simulados need: which card is expanded, the\n * questions and observation of each expanded card, and the two save actions.\n * The list itself stays with the caller, because each modal gets it from a\n * different endpoint.\n *\n * Responses are tagged with a session. The session changes whenever the modal\n * opens, the student changes or the API client changes, and a response from an\n * older session is dropped instead of written into the current one.\n *\n * @param params - API client, the enrollment being shown and the open flag\n * @returns Expanded card, loaded details and notes, and the actions on them\n *\n * @example\n * ```tsx\n * const { expandedId, details, notes, toggle } = useSimulationCardDetails({\n * api,\n * userInstitutionId: student?.userInstitutionId ?? null,\n * isOpen,\n * });\n * ```\n */\nexport function useSimulationCardDetails({\n api,\n userInstitutionId,\n isOpen,\n}: UseSimulationCardDetailsParams): UseSimulationCardDetailsReturn {\n const useSimulations = useMemo(() => createUseSimulations(api), [api]);\n const {\n fetchSimulationDetail,\n fetchNote,\n uploadNoteAttachment,\n saveNote,\n saveQuestionComment,\n } = useSimulations();\n\n const [expandedId, setExpandedId] = useState<string | null>(null);\n const [details, setDetails] = useState<Record<string, SimulationDetailState>>(\n {}\n );\n const [notes, setNotes] = useState<Record<string, SimulationNoteState>>({});\n\n // Guards state updates against the modal unmounting mid-request.\n const mountedRef = useRef(true);\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n // Bumped on every new session, so a slow response from the previous student\n // (or from a replaced API client) is dropped instead of written into the\n // current one.\n const sessionRef = useRef(0);\n useEffect(() => {\n sessionRef.current += 1;\n setExpandedId(null);\n setDetails({});\n setNotes({});\n }, [isOpen, userInstitutionId, api]);\n\n const isStale = useCallback(\n (session: number) => !mountedRef.current || sessionRef.current !== session,\n []\n );\n\n const loadDetail = useCallback(\n (enrollmentId: string, simulationId: string) => {\n const session = sessionRef.current;\n setDetails((previous) => ({\n ...previous,\n [simulationId]: { loading: true, error: null, data: null },\n }));\n fetchSimulationDetail(enrollmentId, simulationId)\n .then((data) => {\n if (isStale(session)) return;\n setDetails((previous) => ({\n ...previous,\n [simulationId]: { loading: false, error: null, data },\n }));\n })\n .catch(() => {\n if (isStale(session)) return;\n setDetails((previous) => ({\n ...previous,\n [simulationId]: {\n loading: false,\n error: 'Erro ao carregar o simulado',\n data: null,\n },\n }));\n });\n },\n [fetchSimulationDetail, isStale]\n );\n\n const loadNote = useCallback(\n (enrollmentId: string, simulationId: string) => {\n const session = sessionRef.current;\n setNotes((previous) => ({\n ...previous,\n [simulationId]: { loading: true, error: null, data: null },\n }));\n fetchNote(enrollmentId, simulationId)\n .then((data) => {\n if (isStale(session)) return;\n setNotes((previous) => ({\n ...previous,\n [simulationId]: { loading: false, error: null, data },\n }));\n })\n .catch(() => {\n if (isStale(session)) return;\n setNotes((previous) => ({\n ...previous,\n [simulationId]: {\n loading: false,\n error: 'Erro ao carregar a observação',\n data: null,\n },\n }));\n });\n },\n [fetchNote, isStale]\n );\n\n const toggle = useCallback(\n (simulationId: string) => {\n if (!userInstitutionId) return;\n const next = expandedId === simulationId ? null : simulationId;\n setExpandedId(next);\n if (!next) return;\n\n // The two requests are guarded separately: a loaded detail must not stop\n // the observation from being fetched, and the other way around.\n if (!details[simulationId]) loadDetail(userInstitutionId, simulationId);\n if (!notes[simulationId]) loadNote(userInstitutionId, simulationId);\n },\n [userInstitutionId, expandedId, details, notes, loadDetail, loadNote]\n );\n\n const retryNote = useCallback(\n (simulationId: string) => {\n if (!userInstitutionId) return;\n loadNote(userInstitutionId, simulationId);\n },\n [userInstitutionId, loadNote]\n );\n\n /**\n * Save the observation of one simulado, uploading a newly chosen file first\n * so only its public URL travels with the note.\n */\n const makeSaveNote = useCallback(\n (simulationId: string): SaveSimulationNote =>\n async (text, file, existingAttachment) => {\n if (!userInstitutionId) return;\n const session = sessionRef.current;\n const attachment = file\n ? await uploadNoteAttachment(file)\n : existingAttachment;\n const saved = await saveNote(\n userInstitutionId,\n simulationId,\n text,\n attachment\n );\n if (isStale(session)) return;\n setNotes((previous) => ({\n ...previous,\n [simulationId]: { loading: false, error: null, data: saved },\n }));\n },\n [userInstitutionId, uploadNoteAttachment, saveNote, isStale]\n );\n\n /**\n * Save a comment on one question and reflect it in the loaded detail, so the\n * field shows what the server now holds without a refetch.\n */\n const makeSaveQuestionComment = useCallback(\n (simulationId: string) => async (questionId: string, comment: string) => {\n if (!userInstitutionId) return;\n const session = sessionRef.current;\n const saved = await saveQuestionComment(\n userInstitutionId,\n simulationId,\n questionId,\n comment\n );\n if (isStale(session)) return;\n setDetails((previous) => {\n const current = previous[simulationId];\n if (!current?.data) return previous;\n return {\n ...previous,\n [simulationId]: {\n ...current,\n data: {\n ...current.data,\n questions: current.data.questions.map((question) =>\n question.questionId === questionId\n ? { ...question, teacherComment: saved?.teacherComment ?? '' }\n : question\n ),\n },\n },\n };\n });\n },\n [userInstitutionId, saveQuestionComment, isStale]\n );\n\n return {\n expandedId,\n details,\n notes,\n toggle,\n retryNote,\n makeSaveNote,\n makeSaveQuestionComment,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAAA,YAAW,WAAAC,UAAS,UAAAC,SAAQ,YAAAC,iBAAgB;AAErD,SAAS,qBAAqB;AAC9B,SAAS,aAAa;;;ACFtB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;;;ACYzB,SAAS,oBAAoB,YAA4B;AAC9D,UAAQ,aAAa,IAAI,eAAe,SAAS;AAAA,IAC/C,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,EACzB,CAAC;AACH;;;ADyCI,cAkBA,YAlBA;AAjBG,SAAS,oBAAoB,YAA0C;AAC5E,QAAM,QAAkB,CAAC;AACzB,MAAI,WAAW,qBAAqB,QAAW;AAC7C,UAAM,KAAK,kBAAY,gBAAgB,WAAW,gBAAgB,CAAC,EAAE;AAAA,EACvE;AACA,MAAI,WAAW,UAAU,QAAW;AAClC,UAAM,KAAK,SAAS,oBAAoB,WAAW,KAAK,CAAC,EAAE;AAAA,EAC7D;AACA,MAAI,WAAW,YAAY;AACzB,UAAM,KAAK,aAAa,sBAAsB,WAAW,UAAU,CAAC,EAAE;AAAA,EACxE;AACA,SAAO,MAAM,KAAK,QAAK;AACzB;AAGO,SAAS,aAAa,EAAE,SAAS,GAAqC;AAC3E,SACE,oBAAC,gBAAK,IAAG,MAAK,MAAK,MAAK,QAAO,QAAO,WAAU,iBAC7C,UACH;AAEJ;AAMO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AACF,GAGG;AACD,SACE,qBAAC,SAAI,WAAU,sGACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,QAAO;AAAA,QACP,WAAU;AAAA,QAET;AAAA;AA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Y,UACtC,gBAAAA;AAAA,QAAC;AAAA;AAAA,UAOC;AAAA,UACA;AAAA,UACA,UAAU,eAAe,WAAW;AAAA,UACpC,UAAU,MAAM,OAAO,WAAW,EAAE;AAAA,UACpC,QAAQ,QAAQ,WAAW,EAAE;AAAA,UAC7B,MAAM,MAAM,WAAW,EAAE;AAAA,UACzB,aAAa,MAAM,UAAU,WAAW,EAAE;AAAA,UAC1C,YAAY,aAAa,WAAW,EAAE;AAAA,UACtC,uBAAuB;AAAA,YACrB,WAAW;AAAA,UACb;AAAA;AAAA,QAXK,GAAG,QAAQ,iBAAiB,IAAI,WAAW,EAAE;AAAA,MAYpD,CACD,GACH;AAAA,OAEJ;AAAA,KAEJ,GAEJ;AAEJ;","names":["useEffect","useMemo","useRef","useState","jsx","jsxs","useState","useRef","useMemo","useEffect"]}
|
|
@@ -8,7 +8,7 @@ var _chunkBVUPM6EYjs = require('./chunk-BVUPM6EY.js');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkY64LT6BLjs = require('./chunk-Y64LT6BL.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkONWBFEW5js = require('./chunk-ONWBFEW5.js');
|
|
@@ -61,9 +61,9 @@ var CalendarCard = ({
|
|
|
61
61
|
)
|
|
62
62
|
] });
|
|
63
63
|
}
|
|
64
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
64
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY64LT6BLjs.DropdownMenu_default, { open: effectiveOpen, onOpenChange: handleOpenChange, children: [
|
|
65
65
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
66
|
-
|
|
66
|
+
_chunkY64LT6BLjs.DropdownMenuTrigger,
|
|
67
67
|
{
|
|
68
68
|
className: `text-primary cursor-pointer ${_nullishCoalesce(className, () => ( ""))}`,
|
|
69
69
|
asChild: true,
|
|
@@ -71,7 +71,7 @@ var CalendarCard = ({
|
|
|
71
71
|
}
|
|
72
72
|
),
|
|
73
73
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
74
|
-
|
|
74
|
+
_chunkY64LT6BLjs.DropdownMenuContent,
|
|
75
75
|
{
|
|
76
76
|
className: "w-[320px] max-w-[calc(100vw-16px)] max-h-[80vh] overflow-y-auto",
|
|
77
77
|
align: "end",
|
|
@@ -87,4 +87,4 @@ var CalendarCard_default = CalendarCard;
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
exports.CalendarCard = CalendarCard; exports.CalendarCard_default = CalendarCard_default;
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-CWTCN6F7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/analytica-frontend-lib/analytica-frontend-lib/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/analytica-frontend-lib/analytica-frontend-lib/dist/chunk-CWTCN6F7.js","../src/components/CalendarCard/CalendarCard.tsx"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACfA,6EAAkC;AAElC,8BAAsC;AAiEhB,+CAAA;AA5Bf,IAAM,aAAA,EAAe,CAAC;AAAA,EAC3B,OAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA,EAAQ,eAAA;AAAA,EACR;AACF,CAAA,EAAA,GAAyB;AACvB,EAAA,MAAM,EAAE,SAAS,EAAA,EAAI,wCAAA,CAAU;AAC/B,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,EAAA,EAAI,6BAAA,KAAc,CAAA;AAEtD,EAAA,MAAM,aAAA,EAAe,OAAA,IAAW,KAAA,CAAA;AAChC,EAAA,MAAM,cAAA,EAAgB,aAAA,EAAe,OAAA,EAAS,Y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,oBAAA,6BAAA;AAAA,MAAC,oCAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,CAAA,4BAAA,mBAA+B,SAAA,UAAa,IAAE,CAAA,CAAA;AAClD,QAAA;AAEK,QAAA;AAA0C,MAAA;AACxD,IAAA;AACA,oBAAA;AAAC,MAAA;AAAA,MAAA;AACW,QAAA;AACJ,QAAA;AACD,QAAA;AAEJ,QAAA;AAAA,MAAA;AACH,IAAA;AACF,EAAA;AAEJ;AAEe;ADxBmD;AACA;AACA;AACA;AACA","file":"/home/runner/work/analytica-frontend-lib/analytica-frontend-lib/dist/chunk-CWTCN6F7.js","sourcesContent":[null,"import { CalendarBlankIcon } from '@phosphor-icons/react/dist/csr/CalendarBlank';\nimport type { ReactNode } from 'react';\nimport { useCallback, useState } from 'react';\nimport DropdownMenu, {\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from '../DropdownMenu/DropdownMenu';\nimport IconButton from '../IconButton/IconButton';\nimport Modal from '../Modal/Modal';\nimport { useMobile } from '../../hooks/useMobile';\n\nexport interface CalendarCardProps {\n /** Content rendered inside the calendar (calendar grid + activities list). */\n content: ReactNode;\n /**\n * Whether the calendar surface is currently open.\n * When provided, the component is **controlled**: the consumer is the source of truth.\n * When omitted, the component manages internal state.\n */\n isOpen?: boolean;\n /**\n * Fired whenever the open state changes (user click, outside click,\n * programmatic close, ESC, etc.).\n */\n onOpenChange?: (open: boolean) => void;\n /** Title displayed in the mobile Modal. Default: \"Calendário\". */\n title?: string;\n /** Optional className applied to the trigger button. */\n className?: string;\n}\n\n/**\n * Calendar widget for the app header. Renders a calendar icon trigger that\n * opens a `DropdownMenu` on tablet/desktop and a `Modal` on mobile (<500px).\n *\n * Pairs naturally with `AppHeader`'s `calendarContent` prop. Use the\n * controlled `isOpen` + `onOpenChange` pair when the consumer needs to close\n * the surface programmatically (e.g. on route change).\n */\nexport const CalendarCard = ({\n content,\n isOpen,\n onOpenChange,\n title = 'Calendário',\n className,\n}: CalendarCardProps) => {\n const { isMobile } = useMobile();\n const [internalOpen, setInternalOpen] = useState(false);\n\n const isControlled = isOpen !== undefined;\n const effectiveOpen = isControlled ? isOpen : internalOpen;\n\n // `useCallback` keeps the reference stable across renders, so the\n // `DropdownMenu`'s `useEffect [open, onOpenChange]` doesn't re-fire on\n // every parent re-render (which is what triggers the infinite update loop\n // observed before).\n const handleOpenChange = useCallback(\n (open: boolean) => {\n if (!isControlled) {\n setInternalOpen(open);\n }\n onOpenChange?.(open);\n },\n [isControlled, onOpenChange]\n );\n\n const iconColor = effectiveOpen ? 'text-primary-950' : 'text-primary';\n const triggerIcon = <CalendarBlankIcon size={24} className={iconColor} />;\n\n if (isMobile) {\n return (\n <>\n <IconButton\n active={effectiveOpen}\n onClick={() => handleOpenChange(!effectiveOpen)}\n icon={triggerIcon}\n className={className}\n />\n <Modal\n isOpen={effectiveOpen}\n onClose={() => handleOpenChange(false)}\n title={title}\n >\n <div className=\"flex justify-center\">{content}</div>\n </Modal>\n </>\n );\n }\n\n return (\n <DropdownMenu open={effectiveOpen} onOpenChange={handleOpenChange}>\n <DropdownMenuTrigger\n className={`text-primary cursor-pointer ${className ?? ''}`}\n asChild\n >\n <IconButton active={effectiveOpen} icon={triggerIcon} />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-[320px] max-w-[calc(100vw-16px)] max-h-[80vh] overflow-y-auto\"\n align=\"end\"\n side=\"bottom\"\n >\n {content}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\nexport default CalendarCard;\n"]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DropdownMenuItem,
|
|
4
4
|
DropdownMenu_default,
|
|
5
5
|
createDropdownStore
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-X2YQT5BS.mjs";
|
|
7
7
|
|
|
8
8
|
// src/components/Search/Search.tsx
|
|
9
9
|
import { XIcon } from "@phosphor-icons/react/dist/csr/X";
|
|
@@ -266,4 +266,4 @@ var Search_default = Search;
|
|
|
266
266
|
export {
|
|
267
267
|
Search_default
|
|
268
268
|
};
|
|
269
|
-
//# sourceMappingURL=chunk-
|
|
269
|
+
//# sourceMappingURL=chunk-E4MLDRLD.mjs.map
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
DropdownMenuItem,
|
|
19
19
|
DropdownMenuTrigger,
|
|
20
20
|
DropdownMenu_default
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-X2YQT5BS.mjs";
|
|
22
22
|
import {
|
|
23
23
|
Modal_default
|
|
24
24
|
} from "./chunk-SDXANFNM.mjs";
|
|
@@ -653,4 +653,4 @@ export {
|
|
|
653
653
|
LegacyNotificationCard,
|
|
654
654
|
NotificationCard_default
|
|
655
655
|
};
|
|
656
|
-
//# sourceMappingURL=chunk-
|
|
656
|
+
//# sourceMappingURL=chunk-ENCFJBY5.mjs.map
|
|
@@ -6,10 +6,10 @@ var _chunkCWMSE7LGjs = require('./chunk-CWMSE7LG.js');
|
|
|
6
6
|
var _chunkZPUXEJOQjs = require('./chunk-ZPUXEJOQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkQHXJB5QMjs = require('./chunk-QHXJB5QM.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkCWTCN6F7js = require('./chunk-CWTCN6F7.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunkZHWRUIVEjs = require('./chunk-ZHWRUIVE.js');
|
|
@@ -29,7 +29,7 @@ var _chunkBVUPM6EYjs = require('./chunk-BVUPM6EY.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkY64LT6BLjs = require('./chunk-Y64LT6BL.js');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
var _chunkANT66KVKjs = require('./chunk-ANT66KVK.js');
|
|
@@ -167,7 +167,7 @@ var AppHeader = ({
|
|
|
167
167
|
}
|
|
168
168
|
),
|
|
169
169
|
showCalendar && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "lg:hidden", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
170
|
-
|
|
170
|
+
_chunkCWTCN6F7js.CalendarCard_default,
|
|
171
171
|
{
|
|
172
172
|
content: calendarContent,
|
|
173
173
|
isOpen: _nullishCoalesce(_nullishCoalesce(calendarOpen, () => ( activeStates.calendar)), () => ( false)),
|
|
@@ -175,7 +175,7 @@ var AppHeader = ({
|
|
|
175
175
|
}
|
|
176
176
|
) }),
|
|
177
177
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
178
|
-
|
|
178
|
+
_chunkQHXJB5QMjs.NotificationCard_default,
|
|
179
179
|
{
|
|
180
180
|
mode: "center",
|
|
181
181
|
isActive: activeStates.notifications,
|
|
@@ -218,7 +218,7 @@ var AppHeader = ({
|
|
|
218
218
|
}
|
|
219
219
|
),
|
|
220
220
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
221
|
-
|
|
221
|
+
_chunkY64LT6BLjs.DropdownMenu_default,
|
|
222
222
|
{
|
|
223
223
|
onOpenChange: (open) => {
|
|
224
224
|
_chunkTN3AYOMVjs.syncDropdownState.call(void 0,
|
|
@@ -230,7 +230,7 @@ var AppHeader = ({
|
|
|
230
230
|
},
|
|
231
231
|
children: [
|
|
232
232
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
233
|
-
|
|
233
|
+
_chunkY64LT6BLjs.DropdownMenuTrigger,
|
|
234
234
|
{
|
|
235
235
|
className: "text-primary cursor-pointer",
|
|
236
236
|
asChild: true,
|
|
@@ -238,6 +238,7 @@ var AppHeader = ({
|
|
|
238
238
|
_chunkBVUPM6EYjs.IconButton_default,
|
|
239
239
|
{
|
|
240
240
|
active: activeStates.profile,
|
|
241
|
+
"aria-label": "Abrir menu de perfil",
|
|
241
242
|
onClick: () => toggleActive("profile"),
|
|
242
243
|
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
243
244
|
_chunkVHS3DYH3js.UserIcon,
|
|
@@ -251,7 +252,7 @@ var AppHeader = ({
|
|
|
251
252
|
}
|
|
252
253
|
),
|
|
253
254
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
254
|
-
|
|
255
|
+
_chunkY64LT6BLjs.DropdownMenuContent,
|
|
255
256
|
{
|
|
256
257
|
className: profileDropdownWidth,
|
|
257
258
|
side: "bottom",
|
|
@@ -259,7 +260,7 @@ var AppHeader = ({
|
|
|
259
260
|
align: "end",
|
|
260
261
|
children: [
|
|
261
262
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
262
|
-
|
|
263
|
+
_chunkY64LT6BLjs.ProfileMenuHeader,
|
|
263
264
|
{
|
|
264
265
|
name: displayName,
|
|
265
266
|
email: displayEmail,
|
|
@@ -267,16 +268,16 @@ var AppHeader = ({
|
|
|
267
268
|
}
|
|
268
269
|
),
|
|
269
270
|
showProfileInfo && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
270
|
-
|
|
271
|
+
_chunkY64LT6BLjs.ProfileMenuInfo,
|
|
271
272
|
{
|
|
272
273
|
schoolName: _nullishCoalesce(_optionalChain([sessionInfo, 'optionalAccess', _11 => _11.schoolName]), () => ( "")),
|
|
273
274
|
classYearName: _nullishCoalesce(_optionalChain([sessionInfo, 'optionalAccess', _12 => _12.className]), () => ( "")),
|
|
274
275
|
schoolYearName: _nullishCoalesce(_optionalChain([sessionInfo, 'optionalAccess', _13 => _13.schoolYearName]), () => ( ""))
|
|
275
276
|
}
|
|
276
277
|
),
|
|
277
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
278
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY64LT6BLjs.ProfileMenuSection, { children: [
|
|
278
279
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
279
|
-
|
|
280
|
+
_chunkY64LT6BLjs.DropdownMenuItem,
|
|
280
281
|
{
|
|
281
282
|
variant: "profile",
|
|
282
283
|
iconLeft: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _User.UserIcon, {}),
|
|
@@ -285,9 +286,9 @@ var AppHeader = ({
|
|
|
285
286
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "md", color: "text-text-700", children: "Meus dados" })
|
|
286
287
|
}
|
|
287
288
|
),
|
|
288
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY64LT6BLjs.ProfileToggleTheme, {})
|
|
289
290
|
] }),
|
|
290
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
291
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY64LT6BLjs.ProfileMenuFooter, { onClick: onLogout })
|
|
291
292
|
]
|
|
292
293
|
}
|
|
293
294
|
)
|
|
@@ -309,4 +310,4 @@ var AppHeader_default = AppHeader;
|
|
|
309
310
|
|
|
310
311
|
|
|
311
312
|
exports.AppHeader = AppHeader; exports.AppHeader_default = AppHeader_default;
|
|
312
|
-
//# sourceMappingURL=chunk-
|
|
313
|
+
//# sourceMappingURL=chunk-IUH7JW7H.js.map
|