diff --git a/src/Constants.tsx b/src/Constants.tsx new file mode 100644 index 0000000..46c0476 --- /dev/null +++ b/src/Constants.tsx @@ -0,0 +1,28 @@ +export const MONTHS = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", +] as const; + +export type MonthValue = (typeof MONTHS)[number]; + +export const DAYS = [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday", +] as const; + +export type DayValue = (typeof DAYS)[number]; diff --git a/src/Themes.tsx b/src/Themes.tsx index 501fb4f..8ef55fb 100644 --- a/src/Themes.tsx +++ b/src/Themes.tsx @@ -4,6 +4,7 @@ type Theme = { primeBg: string, messageBorderBg: string, placeholderBg: string, + calenderBg: string, } const defaultLight: Theme = { @@ -11,7 +12,8 @@ const defaultLight: Theme = { primeFg: "#3B3329", primeBg: "#FFEEDE", messageBorderBg: "#FFFFFF", - placeholderBg: "#D9D9D9" + placeholderBg: "#D9D9D9", + calenderBg: "#FBD5B2", } let currentTheme: Theme = defaultLight; diff --git a/src/app/Calender.tsx b/src/app/Calender.tsx new file mode 100644 index 0000000..6fd4d04 --- /dev/null +++ b/src/app/Calender.tsx @@ -0,0 +1,118 @@ +import { Pressable, Text, View } from "react-native"; +import { DAYS, MONTHS } from "../Constants"; +import Header from "../components/Header"; +import { useState } from "react"; +import currentTheme from "../Themes"; +import BaseBackground from "../components/BaseBackground"; + +// TODO: month selection dropdown menu + +const Calender = () => ( + + + + + +); + +const CalenderHeader = () => { + const [monthIndex, setMonthIndex] = useState(0); + const [currentYear, setCurrentYear] = useState(2025); + + const changeMonth = (delta: number) => { + setMonthIndex((prev) => { + const newIndex = prev + delta; + if (newIndex > 11) { + setCurrentYear(currentYear + 1); + return 0; + } + if (newIndex < 0) { + setCurrentYear(currentYear - 1); + return 11; + } + return newIndex; + }); + }; + + const prevMonth = () => changeMonth(-1); + const nextMonth = () => changeMonth(1); + + return ( +
+ + + {MONTHS[monthIndex]} {currentYear} + + "} /> +
+ ); +}; + +type ChangeMonthButtonProps = { + onPress: () => void; + title: string; +}; + +const ChangeMonthButton = (props: ChangeMonthButtonProps) => ( + + {props.title} + +); + +const WeekDaysLine = () => ( + + {/* TODO: px and gap need fine tuning to perfectly align with the grid */} + {DAYS.map((day, i) => ( + {day.substring(0, 2).toUpperCase()} + ))} + +); + +const CalenderGrid = () => ( + + {Array.from({ length: 6 }).map((_, i) => ( + + {/* TODO: correctly retrieve or calculate the date */} + {Array.from({ length: 7 }).map((_, j) => ( + + ))} + + ))} + +); + +type SingleDayProps = { + date: number, +} + +const SingleDay = (props: SingleDayProps) => ( + + + {props.date} + + +); + +export default Calender; diff --git a/src/app/Chat.tsx b/src/app/Chat.tsx index c8743f1..91fcd63 100644 --- a/src/app/Chat.tsx +++ b/src/app/Chat.tsx @@ -2,6 +2,7 @@ import { View, Text, FlatList, TextInput } from "react-native"; import currentTheme from "../Themes"; import { useState } from "react"; import Header from "../components/Header"; +import BaseBackground from "../components/BaseBackground"; // TODO: better shadows for everything // (maybe with extra library because of differences between android and ios) @@ -243,12 +244,7 @@ const messages: MessageData[] = [ const Chat = () => { return ( - + { // extraData={selectedId} might need this later for re-rendering /> - + ); }; const ChatHeader = () => { return ( -
+
{ + return ( + + {props.children} + + ) +} + +export default BaseBackground; diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 4fa5bf4..6a90c2e 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -4,13 +4,14 @@ import { ReactNode } from "react"; type HeaderProps = { children?: ReactNode; + className?: string; }; const Header = (props: HeaderProps) => { return (