11import { ResponsiveCalendar } from "@nivo/calendar" ;
22import { Card } from "@/components/ui/card" ;
3- import { Button , Box } from "@radix-ui/themes" ;
4- import { useNavigate } from "react-router-dom" ;
3+ import { Container } from "@radix-ui/themes" ;
54import { useErrorBoundary } from "react-error-boundary" ;
65import { subYears , format } from "date-fns" ;
76import { Title } from "../ui/styled" ;
87import { motion } from "framer-motion" ;
98import { useCalendar } from "@/hooks/queries/useCalendar" ;
109import { LoadingSpinner } from "../LoadingSpinner" ;
1110import { useIsMobile } from "@/hooks/useIsMobile" ;
11+ import PageContainer from "../PageContainer" ;
1212
1313const NEXT_PAGE = "/" ;
1414
1515export default function ActivityCalendarPage ( ) {
16- const navigate = useNavigate ( ) ;
1716 const { showBoundary } = useErrorBoundary ( ) ;
1817 const isMobile = useIsMobile ( ) ;
1918 const { data, isLoading, error } = useCalendar ( ) ;
@@ -30,42 +29,35 @@ export default function ActivityCalendarPage() {
3029 const toDate = format ( new Date ( ) , "yyyy-MM-dd" ) ;
3130
3231 return (
33- < Box
34- style = { { backgroundColor : "var(--gray-8)" } }
35- className = "min-h-screen p-8"
36- >
37- < Card className = "p-6" >
38- < Title as = { motion . h2 } className = "text-2xl font-bold mb-4" >
39- Your Viewing Activity
40- </ Title >
41- < div style = { { height : isMobile ? "300px" : "500px" } } >
42- < ResponsiveCalendar
43- data = { data ?? [ ] }
44- from = { fromDate }
45- to = { toDate }
46- emptyColor = "#eeeeee"
47- colors = { [ "#61cdbb" , "#97e3d5" , "#e8c1a0" , "#f47560" ] }
48- margin = {
49- isMobile
50- ? { top : 20 , right : 20 , bottom : 20 , left : 20 }
51- : { top : 40 , right : 40 , bottom : 40 , left : 40 }
52- }
53- yearSpacing = { 40 }
54- monthBorderColor = "#ffffff"
55- dayBorderWidth = { 2 }
56- dayBorderColor = "#ffffff"
57- />
58- </ div >
59- </ Card >
60- < Button
61- size = { "4" }
62- style = { { width : "100%" , marginTop : "1rem" } }
63- onClick = { ( ) => {
64- void navigate ( NEXT_PAGE ) ;
65- } }
66- >
67- Finish
68- </ Button >
69- </ Box >
32+ < PageContainer backgroundColor = "var(--indigo-8)" nextPage = { NEXT_PAGE } previousPage = "/device-stats" >
33+ < Container size = "4" p = "4" >
34+ < Card className = "p-6" >
35+ < Title as = { motion . h2 } className = "text-2xl font-bold mb-4" >
36+ Your Viewing Activity
37+ </ Title >
38+ < p style = { { fontSize : "1.125rem" , color : "var(--gray-11)" , marginBottom : "1rem" } } >
39+ A calendar view of your daily viewing patterns
40+ </ p >
41+ < div style = { { height : isMobile ? "300px" : "500px" } } >
42+ < ResponsiveCalendar
43+ data = { data ?? [ ] }
44+ from = { fromDate }
45+ to = { toDate }
46+ emptyColor = "#eeeeee"
47+ colors = { [ "#61cdbb" , "#97e3d5" , "#e8c1a0" , "#f47560" ] }
48+ margin = {
49+ isMobile
50+ ? { top : 20 , right : 20 , bottom : 20 , left : 20 }
51+ : { top : 40 , right : 40 , bottom : 40 , left : 40 }
52+ }
53+ yearSpacing = { 40 }
54+ monthBorderColor = "#ffffff"
55+ dayBorderWidth = { 2 }
56+ dayBorderColor = "#ffffff"
57+ />
58+ </ div >
59+ </ Card >
60+ </ Container >
61+ </ PageContainer >
7062 ) ;
7163}
0 commit comments