Skip to content

Commit

Permalink
Merge branch 'main' into 333-home-page-add-partners-section
Browse files Browse the repository at this point in the history
  • Loading branch information
samderanova authored Jan 26, 2024
2 parents 6dfa876 + 3568acb commit 2e840e1
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 50 deletions.
69 changes: 55 additions & 14 deletions apps/sanity/sanity.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {visionTool} from '@sanity/vision'
import {colorInput} from '@sanity/color-input'
import {schemaTypes} from './schemas'
import { defineConfig } from "sanity";
import { deskTool } from "sanity/desk";
import { visionTool } from "@sanity/vision";
import { colorInput } from "@sanity/color-input";
import { schemaTypes } from "./schemas";
import { ListOrdered, Folders, Globe } from "lucide-react";

export default defineConfig({
name: 'default',
title: 'irvinehacks-site-2024',
name: "default",
title: "irvinehacks-site-2024",

projectId: 'fosuyru0',
dataset: 'production',
projectId: "fosuyru0",
dataset: "production",

plugins: [deskTool(), visionTool(), colorInput()],
plugins: [
deskTool({
structure: (S) =>
S.list()
.title("Content")
.items([
...S.documentTypeListItems().filter(
(listItem) =>
![
"resourceCategoryOrder",
"resourceCategory",
"resource",
].includes(listItem.getId()!)
),
S.divider(),
S.listItem()
.title("Resource Categories Order")
.icon(ListOrdered)
.child(
S.document()
.schemaType("resourceCategoryOrder")
.documentId("resourceCategoryOrder")
.title("Resource Categories Order")
),
S.listItem()
.title("Resource Categories")
.icon(Folders)
.child(
S.documentTypeList("resourceCategory").title(
"Resource Categories"
)
),
S.listItem()
.title("Resources")
.icon(Globe)
.child(S.documentTypeList("resource").title("Resources")),
]),
}),
visionTool(),
colorInput(),
],

schema: {
types: schemaTypes,
},
})
schema: {
types: schemaTypes,
},
});
2 changes: 2 additions & 0 deletions apps/sanity/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import event from "./event";
import partners from "./partners";
import resource from "./resource";
import resourceCategory from "./resourceCategory";
import resourceCategoryOrder from "./resourceCategoryOrder";
import sponsors from "./sponsors";

export const schemaTypes = [
Expand All @@ -11,5 +12,6 @@ export const schemaTypes = [
partners,
resource,
resourceCategory,
resourceCategoryOrder,
sponsors,
];
21 changes: 21 additions & 0 deletions apps/sanity/schemas/resourceCategoryOrder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineArrayMember, defineField, defineType } from "sanity";

export default defineType({
name: "resourceCategoryOrder",
title: "Resource Categories Order",
type: "document",
fields: [
defineField({
name: "order",
title: "Order",
type: "array",
of: [
defineArrayMember({
type: "reference",
to: { type: "resourceCategory" },
}),
],
validation: (Rule) => Rule.required(),
}),
],
});
10 changes: 10 additions & 0 deletions apps/site/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ const nextConfig = {
destination: DOCUSIGN_FORM_URL,
permanent: true,
},
{
source: "/incident",
destination: "https://forms.gle/A6BdsSzYSiyeTP8Y6",
permanent: true,
},
{
source: "/devpost",
destination: "https://irvinehacks-2024.devpost.com",
permanent: true,
},
];
},
};
Expand Down
41 changes: 32 additions & 9 deletions apps/site/src/app/(main)/resources/getResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,39 @@ import { z } from "zod";
import { cache } from "react";
import { client } from "@/lib/sanity/client";
import { SanityDocument, SanityReference } from "@/lib/sanity/types";
import { groq } from "next-sanity";

const Resources = z.array(
SanityDocument.extend({
_type: z.literal("resource"),
link: z.string(),
title: z.string(),
resourceType: SanityReference,
}),
);
const Resources = z.object({
order: z.array(
z.object({
_id: z.string(),
iconUrl: z.string(),
title: z.string(),
description: z.string(),
resources: z.array(
SanityDocument.extend({
_type: z.literal("resource"),
link: z.string(),
title: z.string(),
resourceType: SanityReference,
}),
),
}),
),
});

export const getResources = cache(async () => {
return Resources.parse(await client.fetch("*[_type == 'resource']"));
return Resources.parse(
await client.fetch(groq`
*[_type == 'resourceCategoryOrder' && _id == "resourceCategoryOrder"][0] {
order[]->{
_id,
'iconUrl': icon.asset->url,
title,
description,
'resources': *[_type == 'resource' && resourceType._ref == ^._id] | order(title asc)
}
}
`),
);
});
60 changes: 60 additions & 0 deletions apps/site/src/app/(main)/resources/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import Button from "@/lib/components/Button/Button";
import { Metadata } from "next";
import { redirect } from "next/navigation";
import { getResources } from "./getResources";

export const revalidate = 60;

export const metadata: Metadata = {
title: "Resources | IrvineHacks 2024",
};

export default async function Resources() {
if (process.env.MAINTENANCE_MODE_RESOURCES) {
redirect("/");
}

const resources = await getResources();

return (
<>
<section className="h-full w-full mb-12">
<div className="my-36">
<h1 className="font-display text-4xl md:text-5xl font-bold mb-2 text-center">
Resources
</h1>
</div>
<div className="mb-40 mx-4 ">
{resources.order.map(
({ _id, iconUrl, title, description, resources }, i) => (
<div
key={_id}
className="max-w-5xl w-full mx-auto mb-12 bg-[var(--color-cream)] text-[#2F1C00] p-12 rounded-2xl lg:grid lg:gap-20 lg:grid-cols-2 lg:items-center"
>
<div>
<div className="flex gap-2 lg:flex-col">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img className="w-8 h-auto lg:w-16" src={iconUrl} alt="" />
<h2 className="text-2xl font-bold">{title}</h2>
</div>
<p>{description}</p>
</div>
<div className="flex flex-col gap-3 lg:gap-4">
{resources.map(({ _id, title, link }) => (
<Button
key={_id}
text={title}
href={link}
className="w-[100%!important] text-center"
// color={i % 2 === 0 ? "light" : "dark"}
/>
))}
</div>
</div>
),
)}
</div>
</section>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { Fireworks } from "@fireworks-js/react";
import styles from "./ShiftingCountdown.module.scss";

// NOTE: Change this date to whatever date you want to countdown to :)
const HACKING_STARTS = "2024-01-26T18:00:00.000";
const HACKING_ENDS = "2024-01-28T24:00:00.000";
const HACKING_STARTS = Date.UTC(2024, 0, 27, 2, 0, 0); // 1/26 at 6pm PST
const HACKING_ENDS = Date.UTC(2024, 0, 28, 20, 0, 0); // 1/28 at 12pm PST

// Testing:
// const HACKING_STARTS = "2023-12-09T21:42:00.000";
// const HACKING_ENDS = "2023-12-09T21:44:00.000";
// const HACKING_STARTS = "2024-01-25T01:18:00.000";
// const HACKING_ENDS = "2024-01-25T01:19:00.000";

const SECOND = 1000;
const MINUTE = SECOND * 60;
Expand Down Expand Up @@ -56,8 +56,14 @@ const ShiftingCountdown = () => {
const minutes = Math.floor((distance % HOUR) / MINUTE);
const seconds = Math.floor((distance % MINUTE) / SECOND);

if (days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
// triggers when HACKING_STARTS timer ends and HACKING_ENDS timer ends
if (
days === 0 &&
hours === 0 &&
minutes === 0 &&
seconds === 0 &&
now >= new Date(HACKING_ENDS)
) {
// triggers when HACKING_ENDS timer ends
setCountdown((prev) => {
return { ...prev, showFireworks: true };
});
Expand Down Expand Up @@ -104,7 +110,7 @@ const ShiftingCountdown = () => {
)}
</div>
{countdown.showFireworks && (
<div className="flex justify-center z-20">
<div className="flex justify-center">
<Fireworks
className="w-full h-full absolute"
options={{
Expand Down
4 changes: 3 additions & 1 deletion apps/site/src/app/(main)/schedule/components/getSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const Events = z.array(

export const getSchedule = cache(async () => {
const events = Events.parse(
await client.fetch("*[_type == 'event'] | order(startTime asc)"),
await client.fetch(
"*[_type == 'event'] | order(startTime asc, endTime asc)",
),
);
const eventsByDay = new Map<string, z.infer<typeof Events>>();

Expand Down
12 changes: 2 additions & 10 deletions apps/site/src/app/(main)/schedule/sections/SchedulePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,11 @@ export default function SchedulePage({ schedule }: ScheduleProps) {
className="flex flex-col justify-center items-center w-full"
>
<Tabs.Content
value={weekdayFormat.format(
convertToPST(day[0].startTime),
)}
value={weekdayFormat.format(convertToPST(day[0].startTime))}
className="w-full"
>
{day.map((event) => {
return (
<EventCard
key={event.title}
now={now}
{...event}
/>
);
return <EventCard key={event.title} now={now} {...event} />;
})}
</Tabs.Content>
</div>
Expand Down
30 changes: 21 additions & 9 deletions apps/site/src/lib/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client";

import Image from "next/image";
import { useState, useEffect } from "react";
import clsx from "clsx";
import * as NavMenu from "@radix-ui/react-navigation-menu";
import clsx from "clsx";
import Image from "next/image";
import { useEffect, useState } from "react";

import NavLinkItem from "./NavbarHelpers";
import Button from "@/lib/components/Button/Button";
import HackLogo from "@/lib/components/HackLogo/HackLogo";
import NavLinkItem from "./NavbarHelpers";

import hamburger from "@/assets/icons/navigation-icon.svg";
import { Identity } from "@/lib/utils/getUserIdentity";
Expand Down Expand Up @@ -70,11 +70,23 @@ function Navbar({ identity }: NavbarProps) {
}
onTransitionEnd={() => setHidden(!listShown)}
>
{/* <NavLinkItem href="/">Home</NavLinkItem>
<NavLinkItem href="/">Sponsor</NavLinkItem>
<NavLinkItem href="/">Schedule</NavLinkItem>
<NavLinkItem href="/">Resources</NavLinkItem>
<NavLinkItem href="/">Stage</NavLinkItem> */}
<NavLinkItem href="/">Home</NavLinkItem>
<NavLinkItem href="/resources">Resources</NavLinkItem>
<NavLinkItem href="/schedule">Schedule</NavLinkItem>
<NavLinkItem
href="/incident"
target="_blank"
rel="noopener noreferrer"
>
Report Incident
</NavLinkItem>
<NavLinkItem
href="/devpost"
target="_blank"
rel="noopener noreferrer"
>
Devpost
</NavLinkItem>
{!status && !deadlinePassed && (
<NavLinkItem href="/apply">Apply</NavLinkItem>
)}
Expand Down

0 comments on commit 2e840e1

Please sign in to comment.