diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png new file mode 100644 index 0000000..9d8e381 Binary files /dev/null and b/public/android-chrome-192x192.png differ diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png new file mode 100644 index 0000000..8394e2b Binary files /dev/null and b/public/android-chrome-512x512.png differ diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..119a719 Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/browserconfig.xml b/public/browserconfig.xml new file mode 100644 index 0000000..b3930d0 --- /dev/null +++ b/public/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #da532c + + + diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png new file mode 100644 index 0000000..73158ca Binary files /dev/null and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png new file mode 100644 index 0000000..7c41a09 Binary files /dev/null and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico index 718d6fe..de74010 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/mstile-150x150.png b/public/mstile-150x150.png new file mode 100644 index 0000000..de81ddb Binary files /dev/null and b/public/mstile-150x150.png differ diff --git a/public/next.svg b/public/next.svg deleted file mode 100644 index 5174b28..0000000 --- a/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/site.webmanifest b/public/site.webmanifest new file mode 100644 index 0000000..b20abb7 --- /dev/null +++ b/public/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/public/vercel.svg b/public/vercel.svg deleted file mode 100644 index d2f8422..0000000 --- a/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/pages/[group].tsx b/src/pages/[group].tsx index 71289bd..c2ef6fd 100644 --- a/src/pages/[group].tsx +++ b/src/pages/[group].tsx @@ -5,6 +5,9 @@ import { getSchedule } from '@/app/agregator/schedule' import { NextSerialized, nextDeserializer, nextSerialized } from '@/app/utils/date-serializer' import { NavBar } from '@/widgets/navbar' import { LastUpdateAt } from '@/entities/last-update-at' +import { groups } from '@/shared/data/groups' +import { useRouter } from 'next/router' +import Head from 'next/head' type PageProps = NextSerialized<{ schedule: Day[] @@ -13,9 +16,17 @@ type PageProps = NextSerialized<{ export default function HomePage(props: PageProps) { const { schedule, parsedAt } = nextDeserializer(props) + const router = useRouter() + const groupName = groups[router.query.group as string][1] return ( <> + + Расписание {groupName} в Колледже Связи + + + + @@ -26,10 +37,6 @@ export default function HomePage(props: PageProps) { const cachedSchedules = new Map() const maxCacheDurationInMS = 1000 * 60 * 60 export async function getServerSideProps(context: GetServerSidePropsContext<{ group: string }>): Promise> { - const groups: { [group: string]: [number, string] } = { - ps7: [146, 'ПС-7'], - pks35k: [78, 'ПКС-35к'] - } const group = context.params?.group if (group && Object.hasOwn(groups, group) && group in groups) { let schedule diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index d8f078a..041d43b 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -3,7 +3,14 @@ import { Html, Head, Main, NextScript } from 'next/document' export default function Document() { return ( - + + + + + + + +
diff --git a/src/shared/data/groups.ts b/src/shared/data/groups.ts new file mode 100644 index 0000000..55a688a --- /dev/null +++ b/src/shared/data/groups.ts @@ -0,0 +1,4 @@ +export const groups: { [group: string]: [number, string] } = { + ps7: [146, 'ПС-7'], + pks35k: [78, 'ПКС-35к'] +} \ No newline at end of file diff --git a/src/widgets/navbar/index.tsx b/src/widgets/navbar/index.tsx index 0074461..8627c1d 100644 --- a/src/widgets/navbar/index.tsx +++ b/src/widgets/navbar/index.tsx @@ -1,3 +1,4 @@ +import React from 'react' import { AddGroupButton } from '@/features/add-group' import { ThemeSwitcher } from '@/features/theme-switch' import { Button } from '@/shadcn/ui/button' @@ -5,13 +6,41 @@ import { useTheme } from 'next-themes' import Link from 'next/link' import { useRouter } from 'next/router' import { FaGithub } from 'react-icons/fa' +import cx from 'classnames' export function NavBar() { - const { resolvedTheme, theme } = useTheme() + const { resolvedTheme } = useTheme() + const [schemeTheme, setSchemeTheme] = React.useState() + const navRef = React.useRef(null) + + const getSchemeTheme = () => { + if (typeof window !== 'undefined') { + return window.localStorage.getItem('theme') || document.querySelector('html')!.style.colorScheme + } else + return 'light' + } + + React.useEffect(() => { + console.log(resolvedTheme, getSchemeTheme()) + setSchemeTheme(getSchemeTheme()) + }, []) + + const theme = resolvedTheme || schemeTheme + console.log('theme', theme, cx('rounded-lg p-2 w-full flex justify-between', { 'bg-slate-200': theme === 'light', 'bg-slate-900': theme === 'dark' })) + + React.useEffect(() => { + if(theme === 'light') { + navRef.current?.classList.add('bg-slate-200') + navRef.current?.classList.remove('bg-slate-900') + } else { + navRef.current?.classList.add('bg-slate-900') + navRef.current?.classList.remove('bg-slate-200') + } + }, [theme]) return (
-