mirror of
https://github.com/Ategon/Jamjar.git
synced 2025-02-12 06:16:21 +00:00
Compare commits
5 commits
2178675f2a
...
4642ea9032
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4642ea9032 | ||
![]() |
a879690129 | ||
![]() |
0e35c13292 | ||
![]() |
2d2ffa7d12 | ||
![]() |
047d630b14 |
11 changed files with 479 additions and 84 deletions
|
@ -1,29 +0,0 @@
|
|||
import Posts from "@/components/posts";
|
||||
import Timers from "@/components/timers";
|
||||
import { Image } from "@nextui-org/react";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div>
|
||||
<div className="absolute left-0 top-0 w-full h-full z-0">
|
||||
<Image
|
||||
src="/images/bg.jpg"
|
||||
alt="Home background"
|
||||
className="object-cover w-full h-full"
|
||||
radius="none"
|
||||
loading="eager"
|
||||
removeWrapper
|
||||
/>
|
||||
<div className="absolute left-0 top-0 w-full h-full bg-gradient-to-r from-black/50 to-transparent z-10" />
|
||||
</div>
|
||||
<div className="z-10 relative flex">
|
||||
<div>
|
||||
<Posts />
|
||||
</div>
|
||||
<div className="w-1/3 flex justify-end">
|
||||
<Timers />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
108
src/app/create-post/page.tsx
Normal file
108
src/app/create-post/page.tsx
Normal file
|
@ -0,0 +1,108 @@
|
|||
"use client";
|
||||
|
||||
import { getCookie, hasCookie } from "@/helpers/cookie";
|
||||
import { Button, Form, Input, Textarea } from "@nextui-org/react";
|
||||
import { redirect } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
|
||||
export default function CreatePostPage() {
|
||||
const [title, setTitle] = useState("");
|
||||
const [content, setContent] = useState("");
|
||||
const [errors, setErrors] = useState({});
|
||||
|
||||
return (
|
||||
<div className="absolute flex items-center justify-center top-0 left-0 w-screen h-screen">
|
||||
<Form
|
||||
className="w-full max-w-xs flex flex-col gap-4"
|
||||
validationErrors={errors}
|
||||
onReset={() => {
|
||||
setTitle("");
|
||||
setContent("");
|
||||
}}
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (!title && !content) {
|
||||
setErrors({
|
||||
title: "Please enter a valid title",
|
||||
content: "Please enter valid content",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!title) {
|
||||
setErrors({ title: "Please enter a valid title" });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!content) {
|
||||
setErrors({ content: "Please enter valid content" });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasCookie("token")) {
|
||||
setErrors({ content: "You are not logged in" });
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
process.env.NEXT_PUBLIC_MODE === "PROD"
|
||||
? "https://d2jam.com/api/v1/post"
|
||||
: "http://localhost:3005/api/v1/post",
|
||||
{
|
||||
body: JSON.stringify({
|
||||
title: title,
|
||||
content: content,
|
||||
username: getCookie("user"),
|
||||
}),
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
authorization: `Bearer ${getCookie("token")}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (response.status == 401) {
|
||||
setErrors({ content: "Invalid user" });
|
||||
return;
|
||||
}
|
||||
|
||||
toast.success("Successfully created post");
|
||||
|
||||
redirect("/");
|
||||
}}
|
||||
>
|
||||
<Input
|
||||
isRequired
|
||||
label="Title"
|
||||
labelPlacement="outside"
|
||||
name="title"
|
||||
placeholder="Enter a title"
|
||||
type="text"
|
||||
value={title}
|
||||
onValueChange={setTitle}
|
||||
/>
|
||||
|
||||
<Textarea
|
||||
isRequired
|
||||
label="Content"
|
||||
labelPlacement="outside"
|
||||
name="content"
|
||||
placeholder="Enter the post body"
|
||||
value={content}
|
||||
onValueChange={setContent}
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<Button color="primary" type="submit">
|
||||
Create
|
||||
</Button>
|
||||
<Button type="reset" variant="flat">
|
||||
Reset
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 15 KiB |
|
@ -57,8 +57,10 @@ export default function UserPage() {
|
|||
return;
|
||||
}
|
||||
|
||||
const token = await response.json();
|
||||
const { token, user } = await response.json();
|
||||
|
||||
document.cookie = `token=${token}`;
|
||||
document.cookie = `user=${user.slug}`;
|
||||
|
||||
toast.success("Successfully logged in");
|
||||
|
||||
|
|
|
@ -2,11 +2,13 @@ import { Image } from "@nextui-org/image";
|
|||
import { Button } from "@nextui-org/button";
|
||||
import { SiDiscord } from "@icons-pack/react-simple-icons";
|
||||
import { Link } from "@nextui-org/react";
|
||||
import Posts from "@/components/posts";
|
||||
import Timers from "@/components/timers";
|
||||
|
||||
export default async function Home() {
|
||||
return (
|
||||
<div>
|
||||
<div className="absolute left-0 top-0 w-full h-full z-0">
|
||||
<div className="w-full">
|
||||
<div className="fixed left-0 top-0 w-full h-full z-0">
|
||||
<Image
|
||||
src="/images/bg.jpg"
|
||||
alt="Home background"
|
||||
|
@ -17,9 +19,9 @@ export default async function Home() {
|
|||
/>
|
||||
<div className="absolute left-0 top-0 w-full h-full bg-gradient-to-r from-black/50 to-transparent z-10" />
|
||||
</div>
|
||||
<div className="relative left-0 top-0 z-10 px-8">
|
||||
<div className="flex gap-20">
|
||||
<div className="flex flex-col gap-4 py-16 sm:py-36 md:py-72">
|
||||
<div className="z-10 relative flex w-full flex-wrap">
|
||||
<div>
|
||||
<div className="flex flex-col gap-4 py-4 sm:py-8 md:py-12 pl-16">
|
||||
<h1 className="text-3xl sm:text-4xl md:text-5xl">Dare2Jam</h1>
|
||||
<p className="text-lg sm:text-xl">April 4th - 7th</p>
|
||||
<div className="flex gap-2">
|
||||
|
@ -34,8 +36,47 @@ export default async function Home() {
|
|||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<Posts />
|
||||
</div>
|
||||
<div className="w-1/3 flex justify-end py-4 sm:py-8 md:py-12 flex-grow">
|
||||
<Timers />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
/* <div>
|
||||
<div className="absolute left-0 top-0 w-full h-full z-0">
|
||||
<Image
|
||||
src="/images/bg.jpg"
|
||||
alt="Home background"
|
||||
className="object-cover w-full h-full"
|
||||
radius="none"
|
||||
loading="eager"
|
||||
removeWrapper
|
||||
/>
|
||||
<div className="absolute left-0 top-0 w-full h-full bg-gradient-to-r from-black/50 to-transparent z-10" />
|
||||
</div>
|
||||
<div className="relative left-0 top-0 z-10 px-8">
|
||||
<div className="flex gap-20">
|
||||
<div className="flex flex-col gap-4 py-16 sm:py-36 md:py-72">
|
||||
<h1 className="text-3xl sm:text-4xl md:text-5xl">Dare2Jam</h1>
|
||||
<p className="text-lg sm:text-xl">April 4th - 7th</p>
|
||||
<div className="flex gap-2">
|
||||
<Link href="https://discord.gg/rfmKzM6ASw" target="_blank">
|
||||
<Button
|
||||
variant="bordered"
|
||||
className="border-white/50 text-white"
|
||||
startContent={<SiDiscord />}
|
||||
>
|
||||
Join the Discord
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> */
|
||||
}
|
||||
|
|
|
@ -48,6 +48,12 @@ export default function UserPage() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (username.length > 32) {
|
||||
setPassword2("");
|
||||
setErrors({ password: "Usernames can be maximum 32 characters" });
|
||||
return;
|
||||
}
|
||||
|
||||
if (password.length < 8) {
|
||||
setPassword2("");
|
||||
setErrors({ password: "Password must be minimum 8 characters" });
|
||||
|
@ -71,8 +77,15 @@ export default function UserPage() {
|
|||
}
|
||||
);
|
||||
|
||||
const token = await response.json();
|
||||
if (response.status == 409) {
|
||||
setErrors({ username: "User already exists" });
|
||||
setPassword2("");
|
||||
return;
|
||||
}
|
||||
|
||||
const { token, user } = await response.json();
|
||||
document.cookie = `token=${token}`;
|
||||
document.cookie = `user=${user.slug}`;
|
||||
|
||||
toast.success("Successfully signed up");
|
||||
|
||||
|
|
|
@ -16,43 +16,55 @@ import {
|
|||
DropdownMenu,
|
||||
DropdownTrigger,
|
||||
Image,
|
||||
Spacer,
|
||||
Tooltip,
|
||||
} from "@nextui-org/react";
|
||||
import { SiDiscord, SiForgejo, SiGithub } from "@icons-pack/react-simple-icons";
|
||||
import { LogInIcon, NotebookPen } from "lucide-react";
|
||||
import { LogInIcon, Menu, NotebookPen, SquarePen } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { hasCookie, getCookies } from "@/helpers/cookie";
|
||||
import { hasCookie, getCookie } from "@/helpers/cookie";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { UserType } from "@/types/UserType";
|
||||
|
||||
export default function Navbar() {
|
||||
const [user, setUser] = useState("");
|
||||
const [user, setUser] = useState<UserType>();
|
||||
const pathname = usePathname();
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
loadUser();
|
||||
async function loadUser() {
|
||||
if (!hasCookie()) {
|
||||
setUser("");
|
||||
if (!hasCookie("token")) {
|
||||
setUser(undefined);
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
process.env.NEXT_PUBLIC_MODE === "PROD"
|
||||
? "https://d2jam.com/api/v1/self"
|
||||
: "http://localhost:3005/api/v1/self",
|
||||
? `https://d2jam.com/api/v1/self?username=${getCookie("user")}`
|
||||
: `http://localhost:3005/api/v1/self?username=${getCookie("user")}`,
|
||||
{
|
||||
headers: { authorization: `Bearer ${getCookies().token}` },
|
||||
headers: { authorization: `Bearer ${getCookie("token")}` },
|
||||
}
|
||||
);
|
||||
|
||||
if ((await response.text()) == "ok") {
|
||||
setUser("ok");
|
||||
if (response.status == 200) {
|
||||
setUser(await response.json());
|
||||
} else {
|
||||
setUser("");
|
||||
setUser(undefined);
|
||||
}
|
||||
}
|
||||
}, [pathname]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = () => {
|
||||
setIsMobile(window.innerWidth <= 768); // Adjust breakpoint as needed
|
||||
};
|
||||
handleResize();
|
||||
window.addEventListener("resize", handleResize);
|
||||
return () => window.removeEventListener("resize", handleResize);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<NavbarBase
|
||||
shouldHideOnScroll
|
||||
|
@ -67,17 +79,261 @@ export default function Navbar() {
|
|||
<Image src="/images/dare2jam.png" alt="Dare2Jam logo" width={80} />
|
||||
</Link>
|
||||
</NavbarBrand>
|
||||
<NavbarContent>
|
||||
<NavbarItem>
|
||||
<Link
|
||||
href="/app"
|
||||
className="text-white flex justify-center duration-500 ease-in-out transition-all transform hover:scale-110"
|
||||
>
|
||||
Beta Site
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
</NavbarContent>
|
||||
<NavbarContent justify="end">
|
||||
{isMobile ? (
|
||||
user ? (
|
||||
<Dropdown>
|
||||
<DropdownTrigger>
|
||||
<Avatar src={user.profilePicture} />
|
||||
</DropdownTrigger>
|
||||
<DropdownMenu className="text-black">
|
||||
<DropdownItem key="create-post" href="/create-post">
|
||||
Create Post
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
key="github"
|
||||
href="https://github.com/Ategon/Jamjar"
|
||||
>
|
||||
GitHub
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
key="forgejo"
|
||||
href="https://git.edikoyo.com/Ategon/Jamjar"
|
||||
>
|
||||
Forgejo
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
key="discord"
|
||||
href="https://discord.gg/rfmKzM6ASw"
|
||||
>
|
||||
Discord
|
||||
</DropdownItem>
|
||||
<DropdownItem key="logout" color="danger" href="/logout">
|
||||
Logout
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
) : (
|
||||
<Dropdown>
|
||||
<DropdownTrigger>
|
||||
<Menu />
|
||||
</DropdownTrigger>
|
||||
<DropdownMenu className="text-black">
|
||||
<DropdownItem
|
||||
key="github"
|
||||
href="https://github.com/Ategon/Jamjar"
|
||||
>
|
||||
GitHub
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
key="forgejo"
|
||||
href="https://git.edikoyo.com/Ategon/Jamjar"
|
||||
>
|
||||
Forgejo
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
key="discord"
|
||||
href="https://discord.gg/rfmKzM6ASw"
|
||||
>
|
||||
Discord
|
||||
</DropdownItem>
|
||||
<DropdownItem key="login" href="/login">
|
||||
Log In
|
||||
</DropdownItem>
|
||||
<DropdownItem key="signup" href="/signup">
|
||||
Sign Up
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
)
|
||||
) : (
|
||||
<div className="flex gap-3 items-center">
|
||||
{user && (
|
||||
<NavbarItem>
|
||||
<Link href="/create-post">
|
||||
<Button
|
||||
endContent={<SquarePen />}
|
||||
className="text-white border-white/50 hover:border-green-100/50 hover:text-green-100 hover:scale-110 transition-all transform duration-500 ease-in-out"
|
||||
variant="bordered"
|
||||
>
|
||||
Create Post
|
||||
</Button>
|
||||
</Link>
|
||||
<Spacer x={32} />
|
||||
</NavbarItem>
|
||||
)}
|
||||
<NavbarItem>
|
||||
<Tooltip
|
||||
delay={1000}
|
||||
content={
|
||||
<div className="px-1 py-2 text-black text-center">
|
||||
<div className="text-small font-bold">GitHub</div>
|
||||
<div className="text-tiny">Source Code</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Link
|
||||
href="https://github.com/Ategon/Jamjar"
|
||||
className="text-white flex justify-center duration-500 ease-in-out transition-all transform hover:scale-125 hover:text-red-100"
|
||||
isExternal
|
||||
>
|
||||
<SiGithub title="" />
|
||||
</Link>
|
||||
</Tooltip>
|
||||
</NavbarItem>
|
||||
<NavbarItem>
|
||||
<Tooltip
|
||||
delay={1000}
|
||||
content={
|
||||
<div className="px-1 py-2 text-black text-center">
|
||||
<div className="text-small font-bold">Forgejo</div>
|
||||
<div className="text-tiny">Source Code</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Link
|
||||
href="https://git.edikoyo.com/Ategon/Jamjar"
|
||||
className="text-white flex justify-center duration-500 ease-in-out transition-all transform hover:scale-125 hover:text-red-100"
|
||||
isExternal
|
||||
>
|
||||
<SiForgejo title="" />
|
||||
</Link>
|
||||
</Tooltip>
|
||||
</NavbarItem>
|
||||
<NavbarItem>
|
||||
<Link
|
||||
href="https://discord.gg/rfmKzM6ASw"
|
||||
className="text-white flex justify-center duration-500 ease-in-out transition-all transform hover:scale-125 hover:text-indigo-100"
|
||||
isExternal
|
||||
>
|
||||
<SiDiscord />
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
<Divider orientation="vertical" className="h-1/2" />
|
||||
{!user ? (
|
||||
<div className="flex gap-3 items-center">
|
||||
<NavbarItem>
|
||||
<Link href="/login">
|
||||
<Button
|
||||
endContent={<LogInIcon />}
|
||||
className="text-white border-white/50 hover:border-green-100/50 hover:text-green-100 hover:scale-110 transition-all transform duration-500 ease-in-out"
|
||||
variant="bordered"
|
||||
>
|
||||
Log In
|
||||
</Button>
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
<NavbarItem>
|
||||
<Link href="/signup">
|
||||
<Button
|
||||
endContent={<NotebookPen />}
|
||||
className="text-white border-white/50 hover:border-green-100/50 hover:text-green-100 hover:scale-110 transition-all transform duration-500 ease-in-out"
|
||||
variant="bordered"
|
||||
>
|
||||
Sign up
|
||||
</Button>
|
||||
</Link>
|
||||
</NavbarItem>
|
||||
</div>
|
||||
) : (
|
||||
<Dropdown>
|
||||
<DropdownTrigger>
|
||||
<Avatar src={user.profilePicture} />
|
||||
</DropdownTrigger>
|
||||
<DropdownMenu>
|
||||
{/* <DropdownItem
|
||||
key="profile"
|
||||
className="text-black"
|
||||
href="/profile"
|
||||
>
|
||||
Profile
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
showDivider
|
||||
key="settings"
|
||||
className="text-black"
|
||||
href="/settings"
|
||||
>
|
||||
Settings
|
||||
</DropdownItem> */}
|
||||
<DropdownItem
|
||||
key="logout"
|
||||
color="danger"
|
||||
className="text-danger"
|
||||
href="/logout"
|
||||
>
|
||||
Logout
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</NavbarContent>
|
||||
</NavbarBase>
|
||||
);
|
||||
}
|
||||
/*
|
||||
|
||||
{isMobile ? (
|
||||
// Mobile view
|
||||
user ? (
|
||||
<Dropdown>
|
||||
<DropdownTrigger>
|
||||
<Avatar src={user.profilePicture} />
|
||||
</DropdownTrigger>
|
||||
<DropdownMenu>
|
||||
<DropdownItem key="create-post" href="/create-post">
|
||||
Create Post
|
||||
</DropdownItem>
|
||||
<DropdownItem key="logout" color="danger" href="/logout">
|
||||
Logout
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
) : (
|
||||
<Dropdown>
|
||||
<DropdownTrigger>
|
||||
<Button auto flat className="text-white">
|
||||
☰
|
||||
</Button>
|
||||
</DropdownTrigger>
|
||||
<DropdownMenu>
|
||||
<DropdownItem key="github" href="https://github.com/Ategon/Jamjar" isExternal>
|
||||
GitHub
|
||||
</DropdownItem>
|
||||
<DropdownItem key="forgejo" href="https://git.edikoyo.com/Ategon/Jamjar" isExternal>
|
||||
Forgejo
|
||||
</DropdownItem>
|
||||
<DropdownItem key="discord" href="https://discord.gg/rfmKzM6ASw" isExternal>
|
||||
Discord
|
||||
</DropdownItem>
|
||||
<DropdownItem key="login" href="/login">
|
||||
Log In
|
||||
</DropdownItem>
|
||||
<DropdownItem key="signup" href="/signup">
|
||||
Sign Up
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
)
|
||||
) : (
|
||||
|
||||
|
||||
user && (
|
||||
<NavbarItem>
|
||||
<Link href="/create-post">
|
||||
<Button
|
||||
endContent={<SquarePen />}
|
||||
className="text-white border-white/50 hover:border-green-100/50 hover:text-green-100 hover:scale-110 transition-all transform duration-500 ease-in-out"
|
||||
variant="bordered"
|
||||
>
|
||||
Create Post
|
||||
</Button>
|
||||
</Link>
|
||||
<Spacer x={32} />
|
||||
</NavbarItem>
|
||||
)
|
||||
<NavbarItem>
|
||||
<Tooltip
|
||||
delay={1000}
|
||||
|
@ -154,24 +410,10 @@ export default function Navbar() {
|
|||
) : (
|
||||
<Dropdown>
|
||||
<DropdownTrigger>
|
||||
<Avatar />
|
||||
<Avatar src={user.profilePicture} />
|
||||
</DropdownTrigger>
|
||||
<DropdownMenu>
|
||||
{/* <DropdownItem
|
||||
key="profile"
|
||||
className="text-black"
|
||||
href="/profile"
|
||||
>
|
||||
Profile
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
showDivider
|
||||
key="settings"
|
||||
className="text-black"
|
||||
href="/settings"
|
||||
>
|
||||
Settings
|
||||
</DropdownItem> */}
|
||||
|
||||
<DropdownItem
|
||||
key="logout"
|
||||
color="danger"
|
||||
|
@ -183,7 +425,5 @@ export default function Navbar() {
|
|||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
)}
|
||||
</NavbarContent>
|
||||
</NavbarBase>
|
||||
);
|
||||
}
|
||||
)
|
||||
</NavbarContent> */
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Avatar, Button, Card, CardBody, Spacer } from "@nextui-org/react";
|
||||
import { Heart, MessageCircle } from "lucide-react";
|
||||
import { Avatar, Card, CardBody, Spacer } from "@nextui-org/react";
|
||||
import { formatDistance } from "date-fns";
|
||||
import Link from "next/link";
|
||||
import { PostType } from "@/types/PostType";
|
||||
|
@ -36,14 +35,14 @@ export default function PostCard({ post }: { post: PostType }) {
|
|||
|
||||
<Spacer y={4} />
|
||||
|
||||
<div className="flex gap-3">
|
||||
{/* <div className="flex gap-3">
|
||||
<Button size="sm">
|
||||
<Heart size={16} /> {post.likers.length}
|
||||
</Button>
|
||||
<Button size="sm">
|
||||
<MessageCircle size={16} /> {0}
|
||||
</Button>
|
||||
</div>
|
||||
</div> */}
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Spacer } from "@nextui-org/react";
|
||||
import Timer from "./Timer";
|
||||
|
||||
export default function Timers() {
|
||||
|
@ -7,6 +8,8 @@ export default function Timers() {
|
|||
name="Jam Start"
|
||||
targetDate={new Date("2025-04-04T18:00:00-05:00")}
|
||||
/>
|
||||
<Spacer y={8} />
|
||||
<p>Site under construction</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,11 +8,22 @@ export function getCookies() {
|
|||
return cookies;
|
||||
}
|
||||
|
||||
export function hasCookie() {
|
||||
export function getCookie(cookie: string) {
|
||||
const pairs = document.cookie.split(";");
|
||||
for (let i = 0; i < pairs.length; i++) {
|
||||
const pair = pairs[i].split("=");
|
||||
if (pair[0] == "token") {
|
||||
const pair = pairs[i].trim().split("=");
|
||||
if (pair[0] == cookie) {
|
||||
return pair[1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function hasCookie(cookie: string) {
|
||||
const pairs = document.cookie.split(";");
|
||||
for (let i = 0; i < pairs.length; i++) {
|
||||
const pair = pairs[i].trim().split("=");
|
||||
if (pair[0] == cookie) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
7
src/types/UserType.ts
Normal file
7
src/types/UserType.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export interface UserType {
|
||||
id: number;
|
||||
slug: string;
|
||||
name: string;
|
||||
profilePicture: string;
|
||||
createdAt: Date;
|
||||
}
|
Loading…
Reference in a new issue