mirror of
https://github.com/fergalmoran/radio-otherway.git
synced 2025-12-22 09:50:29 +00:00
Extra cron logging
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -38,4 +38,5 @@ next-env.d.ts
|
||||
|
||||
.private/
|
||||
radio-otherway-service-account.json
|
||||
serviceAccount.json
|
||||
serviceAccount.json
|
||||
/.env.production
|
||||
|
||||
2
.idea/web.iml
generated
2
.idea/web.iml
generated
@@ -6,6 +6,8 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.yarn" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.private" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.vercel" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
@@ -38,7 +38,7 @@ const Navbar = () => {
|
||||
<Link
|
||||
href="/signup"
|
||||
id="signup"
|
||||
className="font-normal normal-case font-body btn-primary btn-sm btn text-primary-content"
|
||||
className="font-normal normal-case font-body btn-primary btn-sm btn"
|
||||
>
|
||||
<PlusSquare size={12} className="mr-2" />
|
||||
Register
|
||||
@@ -58,7 +58,7 @@ const Navbar = () => {
|
||||
);
|
||||
|
||||
return (
|
||||
<nav className="w-full navbar bg-secondary-content text-accent-focus">
|
||||
<nav className="w-full navbar bg-primary text-base-200 shadow-lg">
|
||||
<Link href="/">
|
||||
<Image src="/logo.png" alt="Otherway" width={42} height={42} />
|
||||
</Link>
|
||||
|
||||
@@ -13,8 +13,18 @@ const ProfilePageComponentNotifications = () => {
|
||||
Here you can setup various different forms of notifications
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 space-y-6 sm:mt-5 sm:space-y-5">
|
||||
<div className="space-x-3 sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-t sm:pt-5">
|
||||
<HeadingSubComponent
|
||||
title="Browser Notifications"
|
||||
subHeading="We'll send you an alert through (this) browser when a show is about to start."
|
||||
/>
|
||||
<div className="mt-1 sm:col-span-2 sm:mt-0">
|
||||
<div className="flex max-w-lg rounded-md shadow-sm">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-x-3 sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-t sm:pt-5">
|
||||
<HeadingSubComponent
|
||||
title="Phone number"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import React from "react";
|
||||
import React, { useCallback } from "react";
|
||||
import { themes } from "./themes";
|
||||
import { useState, useEffect } from "react";
|
||||
import { IoColorPaletteOutline } from "react-icons/io5";
|
||||
@@ -7,77 +7,76 @@ import { BiDownArrow } from "react-icons/bi";
|
||||
import { defaults } from "@/lib/constants";
|
||||
|
||||
const ThemeSelector = () => {
|
||||
const [activeTheme, setActiveTheme] = useState(
|
||||
document?.body.dataset.theme ||
|
||||
localStorage.getItem("theme") ||
|
||||
defaults.defaultTheme
|
||||
);
|
||||
const [activeTheme, setActiveTheme] = useState(
|
||||
typeof window !== "undefined" && localStorage.getItem("theme") ||
|
||||
defaults.defaultTheme);
|
||||
//
|
||||
useEffect(() => {
|
||||
if (document) {
|
||||
document.body.dataset.theme = activeTheme;
|
||||
window.localStorage.setItem("theme", activeTheme);
|
||||
}
|
||||
}, [activeTheme]);
|
||||
|
||||
useEffect(() => {
|
||||
if (document) {
|
||||
document.body.dataset.theme = activeTheme;
|
||||
window.localStorage.setItem("theme", activeTheme);
|
||||
}
|
||||
}, [activeTheme]);
|
||||
const _switchTheme = (theme: string) => {
|
||||
setActiveTheme(theme);
|
||||
const elem = document.activeElement as HTMLElement;
|
||||
elem?.blur();
|
||||
};
|
||||
return (
|
||||
<div title="Change Theme" className="dropdown-end dropdown">
|
||||
<div tabIndex={0} className="gap-1 normal-case btn-ghost btn">
|
||||
<IoColorPaletteOutline className="inline-block w-5 h-5 stroke-current md:h-6 md:w-6" />
|
||||
const _switchTheme = useCallback((theme: string) => {
|
||||
setActiveTheme(theme);
|
||||
const elem = document.activeElement as HTMLElement;
|
||||
elem?.blur();
|
||||
}, []);
|
||||
|
||||
<span className="hidden md:inline">Theme</span>
|
||||
<BiDownArrow className="hidden w-3 h-3 ml-1 fill-current opacity-60 sm:inline-block" />
|
||||
</div>
|
||||
<div
|
||||
className="dropdown-content rounded-t-box rounded-b-box top-px h-[70vh] max-h-96 w-52 overflow-y-auto bg-base-200 text-base-content shadow-2xl">
|
||||
<div className="grid grid-cols-1 gap-3 p-3" tabIndex={0}>
|
||||
{themes.map((theme) => (
|
||||
<button
|
||||
key={theme.id}
|
||||
className="overflow-hidden text-left rounded-lg outline-base-content"
|
||||
onClick={() => _switchTheme(theme.id)}
|
||||
>
|
||||
<div
|
||||
data-theme={theme.id}
|
||||
className="w-full font-sans cursor-pointer bg-base-100 text-base-content"
|
||||
return (
|
||||
<div title="Change Theme" className="dropdown-end dropdown">
|
||||
<div tabIndex={0} className="gap-1 normal-case btn-ghost btn">
|
||||
<IoColorPaletteOutline className="inline-block w-5 h-5 stroke-current md:h-6 md:w-6" />
|
||||
|
||||
<span className="hidden md:inline">Theme</span>
|
||||
<BiDownArrow className="hidden w-3 h-3 ml-1 fill-current opacity-60 sm:inline-block" />
|
||||
</div>
|
||||
<div
|
||||
className="dropdown-content rounded-t-box rounded-b-box top-px h-[70vh] max-h-96 w-52 overflow-y-auto bg-base-200 text-base-content shadow-2xl">
|
||||
<div className="grid grid-cols-1 gap-3 p-3" tabIndex={0}>
|
||||
{themes.map((theme) => (
|
||||
<button
|
||||
key={theme.id}
|
||||
className="overflow-hidden text-left rounded-lg outline-base-content"
|
||||
onClick={() => _switchTheme(theme.id)}
|
||||
>
|
||||
<div className="grid grid-cols-5 grid-rows-3">
|
||||
<div className="flex items-center col-span-5 row-span-3 row-start-1 gap-2 px-4 py-3">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
className="invisible w-3 h-3"
|
||||
>
|
||||
<path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" />
|
||||
</svg>
|
||||
<div className="flex-grow text-sm font-bold">
|
||||
{theme.id}
|
||||
</div>
|
||||
<div className="flex flex-wrap flex-shrink-0 h-full gap-1">
|
||||
<div className="w-2 rounded bg-primary">
|
||||
<div className="w-2 rounded bg-secondary">
|
||||
<div className="w-2 rounded bg-accent">
|
||||
<div className="w-2 rounded bg-neutral"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
data-theme={theme.id}
|
||||
className="w-full font-sans cursor-pointer bg-base-100 text-base-content"
|
||||
>
|
||||
<div className="grid grid-cols-5 grid-rows-3">
|
||||
<div className="flex items-center col-span-5 row-span-3 row-start-1 gap-2 px-4 py-3">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
className="invisible w-3 h-3"
|
||||
>
|
||||
<path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" />
|
||||
</svg>
|
||||
<div className="flex-grow text-sm font-bold">
|
||||
{theme.id}
|
||||
</div>
|
||||
<div className="flex flex-wrap flex-shrink-0 h-full gap-1">
|
||||
<div className="w-2 rounded bg-primary" />
|
||||
<div className="w-2 rounded bg-secondary" />
|
||||
<div className="w-2 rounded bg-accent" />
|
||||
<div className="w-2 rounded bg-neutral" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
;
|
||||
}
|
||||
;
|
||||
|
||||
export default ThemeSelector;
|
||||
|
||||
@@ -8,14 +8,18 @@ import Settings from "@/lib/db/settings";
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
try {
|
||||
logger.debug("API:cache", "Starting cache of events");
|
||||
const syncToken = await Settings.read("CalendarSyncToken");
|
||||
logger.debug("API:cache", "Sync token", syncToken);
|
||||
const e = await getCalendarEntries(syncToken);
|
||||
logger.debug("API:cache", "Got events", e?.events);
|
||||
if (!e?.events) {
|
||||
res.status(204).json({ result: "No calendar entries found" });
|
||||
} else {
|
||||
const entries = e?.events.map((r: any) => Show.fromJson(r));
|
||||
logger.debug("API:cache", "Mapping events", entries);
|
||||
for (const entry of entries) {
|
||||
logger.debug("Storing show", entry);
|
||||
logger.debug("API:cache", "Mapping event", entry);
|
||||
const showRef = doc(shows, entry.id);
|
||||
await setDoc(showRef, {
|
||||
title: entry.title,
|
||||
@@ -33,6 +37,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
logger.error(err);
|
||||
res.status(500).json({ status: "Error" });
|
||||
}
|
||||
|
||||
res.end();
|
||||
};
|
||||
export default handler;
|
||||
|
||||
Reference in New Issue
Block a user