Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Justin exhibit redo #67

Merged
merged 106 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 105 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
93c450f
added database and page
jxmoose Mar 11, 2024
c5666c0
fixed lint errors lol...
jxmoose Mar 11, 2024
8a04cae
style changes
jxmoose Mar 11, 2024
f845353
prettier
jxmoose Mar 11, 2024
9e249e3
added database and page
jxmoose Mar 11, 2024
531641d
fixed lint errors lol...
jxmoose Mar 11, 2024
6733425
update package-lock
jxmoose Mar 11, 2024
f870a0b
small style
jxmoose Mar 11, 2024
6acd1b9
added exhibit component
jxmoose Mar 16, 2024
f0cf208
adding comp
jxmoose Mar 16, 2024
bd9d09f
finished?
jxmoose Mar 16, 2024
221e26d
added to nav bar
jxmoose Mar 17, 2024
0fea102
removed cateogry for now
jxmoose Mar 17, 2024
66c5c96
prettier changes
jxmoose Mar 17, 2024
3eead25
feat: disabling github actions until MPH / post-MPH
andreisito Mar 11, 2024
3a91e91
chore: prettier
andreisito Mar 11, 2024
aeddf86
chore: disabled only the tsc compiler for now
andreisito Mar 11, 2024
ce67e03
adding comp
jxmoose Mar 16, 2024
63617e3
finished?
jxmoose Mar 16, 2024
7f28513
prettier changes
jxmoose Mar 17, 2024
1ba952e
removed category from table and small fixes
jxmoose Apr 5, 2024
fce6823
added linking from map
jxmoose Apr 10, 2024
4a6ee18
added database and page
jxmoose Mar 11, 2024
f6d4b36
fixed lint errors lol...
jxmoose Mar 11, 2024
b76f6fb
style changes
jxmoose Mar 11, 2024
f22642f
prettier
jxmoose Mar 11, 2024
230b386
added database and page
jxmoose Mar 11, 2024
24f9034
fixed lint errors lol...
jxmoose Mar 11, 2024
9f5a102
update package-lock
jxmoose Mar 11, 2024
e1258d1
small style
jxmoose Mar 11, 2024
4f41ab2
added exhibit component
jxmoose Mar 16, 2024
6acf8c6
adding comp
jxmoose Mar 16, 2024
741b290
finished?
jxmoose Mar 16, 2024
463c097
added to nav bar
jxmoose Mar 17, 2024
f78e9a4
removed cateogry for now
jxmoose Mar 17, 2024
655a9b9
prettier changes
jxmoose Mar 17, 2024
776e0ec
feat: disabling github actions until MPH / post-MPH
andreisito Mar 11, 2024
fda7a2e
chore: prettier
andreisito Mar 11, 2024
266e728
chore: disabled only the tsc compiler for now
andreisito Mar 11, 2024
4c559a8
adding comp
jxmoose Mar 16, 2024
bbf2efe
finished?
jxmoose Mar 16, 2024
c8e92e7
prettier changes
jxmoose Mar 17, 2024
8383d06
removed category from table and small fixes
jxmoose Apr 5, 2024
8e398fe
added linking from map
jxmoose Apr 10, 2024
d3b99a9
Merge branch 'justinxue/phs-49-exhibit-page' of github.com:calbluepri…
jxmoose Apr 10, 2024
7f561ec
design changes + adding active state to buttons
jxmoose Apr 10, 2024
2113ada
big database edits to make fun facts possible on map
jxmoose Apr 11, 2024
f5b8784
supabase function change
jxmoose Apr 11, 2024
3ed4501
documentation changes + tailwind changes
jxmoose Apr 12, 2024
2bab665
small styling changes
jxmoose Apr 21, 2024
c285798
some wbe changes
jxmoose Apr 28, 2024
7fcdd1a
maybe will make components equal heightsl ater if have time i cant fi…
jxmoose Apr 28, 2024
6a30121
web resize changes
jxmoose May 14, 2024
dfc350e
edit nav bar
jxmoose May 22, 2024
fd89077
added database and page
jxmoose Mar 11, 2024
2159bf4
fixed lint errors lol...
jxmoose Mar 11, 2024
810811a
style changes
jxmoose Mar 11, 2024
8c74087
prettier
jxmoose Mar 11, 2024
d836c91
added database and page
jxmoose Mar 11, 2024
fe8bdf4
fixed lint errors lol...
jxmoose Mar 11, 2024
904f4ab
update package-lock
jxmoose Mar 11, 2024
52de64b
small style
jxmoose Mar 11, 2024
7a2cb82
added exhibit component
jxmoose Mar 16, 2024
e4655ea
adding comp
jxmoose Mar 16, 2024
894bfcf
finished?
jxmoose Mar 16, 2024
af68182
added to nav bar
jxmoose Mar 17, 2024
541e5f0
removed cateogry for now
jxmoose Mar 17, 2024
7186e23
prettier changes
jxmoose Mar 17, 2024
7c86134
feat: disabling github actions until MPH / post-MPH
andreisito Mar 11, 2024
f123c27
chore: prettier
andreisito Mar 11, 2024
76321b3
chore: disabled only the tsc compiler for now
andreisito Mar 11, 2024
b7fe1f8
adding comp
jxmoose Mar 16, 2024
c0daf14
finished?
jxmoose Mar 16, 2024
daa1f86
prettier changes
jxmoose Mar 17, 2024
8bfad34
removed category from table and small fixes
jxmoose Apr 5, 2024
93b13f3
added linking from map
jxmoose Apr 10, 2024
c07e488
added database and page
jxmoose Mar 11, 2024
d80d9ee
fixed lint errors lol...
jxmoose Mar 11, 2024
d84dbac
style changes
jxmoose Mar 11, 2024
e8c753d
prettier
jxmoose Mar 11, 2024
dad384f
fixed lint errors lol...
jxmoose Mar 11, 2024
2b20a5a
update package-lock
jxmoose Mar 11, 2024
e2a0f12
small style
jxmoose Mar 11, 2024
73d7167
added exhibit component
jxmoose Mar 16, 2024
e3983c5
adding comp
jxmoose Mar 16, 2024
e466d44
finished?
jxmoose Mar 16, 2024
0551e10
added to nav bar
jxmoose Mar 17, 2024
ba5a5e8
removed cateogry for now
jxmoose Mar 17, 2024
de92214
prettier changes
jxmoose Mar 17, 2024
cbe26bc
adding comp
jxmoose Mar 16, 2024
fd62d6b
finished?
jxmoose Mar 16, 2024
a83fa14
prettier changes
jxmoose Mar 17, 2024
e7f7345
removed category from table and small fixes
jxmoose Apr 5, 2024
16ff616
added linking from map
jxmoose Apr 10, 2024
87ed86c
design changes + adding active state to buttons
jxmoose Apr 10, 2024
69a9544
big database edits to make fun facts possible on map
jxmoose Apr 11, 2024
30153dd
supabase function change
jxmoose Apr 11, 2024
25b5c62
documentation changes + tailwind changes
jxmoose Apr 12, 2024
4d4cb09
small styling changes
jxmoose Apr 21, 2024
ed43990
some wbe changes
jxmoose Apr 28, 2024
0535ccd
maybe will make components equal heightsl ater if have time i cant fi…
jxmoose Apr 28, 2024
64da446
web resize changes
jxmoose May 14, 2024
3158aa8
edit nav bar
jxmoose May 22, 2024
bbe6f7f
Merge branch 'justin-exhibit-redo' of github.com:calblueprint/phs int…
jxmoose May 22, 2024
f6cdcf9
small post rebase fixes
jxmoose May 22, 2024
eb196c4
Merge branch 'main' into justin-exhibit-redo
sarahhpeng May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Lint

#############################
# Start the job on push #
#############################
on:
push:
branches-ignore: [main]
pull_request:
branches: [main]

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Run ESLint, Prettier, and TypeScript compiler
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0

################################
# Install packages #
################################
- name: Install packages
run: npm ci
################################
# Lint codebase #
################################
- name: Run ESLint
run: npx lint-staged
################################
# Check Prettier on codebase #
################################
- name: Run Prettier
run: npx prettier --check .
################################
# Check for TypeScript errors #
# TODO: Add this back once outstanding issues are resolved by all devs.
################################
# - name: Run TypeScript compiler (tsc) on staged files
# run: |
# # Get list of staged TypeScript files
# files=$(git diff --cached --name-only --diff-filter=d | grep '\.tsx\?$')

# # Run tsc on each file
# for file in $files
# do
# npx tsc --noEmit $file || exit 1
# done
142 changes: 142 additions & 0 deletions src/app/exhibitsPage/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
'use client';

import React, { useEffect, useState } from 'react';
import Link from 'next/link';
import NavBar from '../../components/userComponents/navBar/navBar';
import { CategoryRow } from '../../types/types';
import { fetchAllCategories } from '../../supabase/category/queries';
import Exhibit from '../../components/userComponents/Exhibit/Exhibit';
import BackButton from '../../components/userComponents/BackButton/page';
import { useWebDeviceDetection } from '../../context/WindowWidthContext/WindowWidthContext';

/**
* @returns exhibit page
*/
function App() {
const isWebDevice = useWebDeviceDetection();
const [exhibits, setExhibits] = useState<CategoryRow[]>([]);
// fetches all the exhibits to display on the page
useEffect(() => {
// Get exhibits
const getExhibits = async () => {
const fetchedExhibits: CategoryRow[] = await fetchAllCategories();
setExhibits(fetchedExhibits);
};
getExhibits();
// Detect the hash in URL and scroll to the element with the corresponding ID
}, [exhibits]);

// activates whenever the page opens.
// checks if there's a "hash" which is an id of one of the exhibits to scroll to.
// scrolls down to corresponding exhibit with slight offset
useEffect(() => {
const { hash } = window.location;
if (hash) {
setTimeout(() => {
const element = document.querySelector(hash);
const yOffset = -200;
if (element) {
const y =
element.getBoundingClientRect().top + window.scrollY + yOffset;
// check on this offset later
window.scrollTo({ top: y, behavior: 'instant' });
}
}, 1000);
}
}, []);
return (
<div>
{!isWebDevice && (
<div className="bg-ivory">
<NavBar />
<div className="p-4 m-auto">
<BackButton />
<div className="flex-col justify-start items-start mt-2">
<h1 className="text-night leading-9 font-['Lato'] mb-4">
Our Exhibits{' '}
</h1>
<p className="text-night leading-5 font-normal font-['Lato']">
The Bay Area is home to a wide variety of plant and animal life.
As you explore the exhibits, you will learn about threatened and
endangered species that are under careful monitoring by
biologists. Protective conservation efforts are in place for
these vulnerable plants and animals. We welcome you to learn
more about these important species throughout the exhibits. Scan
the QR codes on display for more information.
</p>
</div>
<Link href="/siteMapPage">
<div className="px-4 py-2 mb-2 mt-6 rounded-md border active:border-hunterGreen border-asparagus justify-start items-start inline-flex">
<p className="active:text-hunterGreen text-center text-asparagus font-bold font-['Lato'] leading-tight">
Go to Map
</p>
</div>
</Link>
<ul>
{exhibits.map(exhibit => (
<Exhibit
title={exhibit.category || ''}
description={exhibit.description || ''}
image={exhibit.image || ''}
key={exhibit.id}
id={exhibit.id}
web={false}
/>
))}
</ul>
</div>
</div>
)}
{isWebDevice && (
<div className="bg-ivory">
<NavBar />
<div className="pl-64 pr-64 pt-24 m-auto">
<p className="text-night font-['Lato']">
{' '}
<Link className="text-scary-forest hover:underline" href="/">
{' '}
Home{' '}
</Link>{' '}
/ Our Exhibits{' '}
</p>
<div className="flex-col justify-start items-start mt-6">
<h1 className="text-night leading-9 font-['Lato'] mb-4">
Our Exhibits{' '}
</h1>
<p className="text-night leading-5 font-normal font-['Lato']">
The Bay Area is home to a wide variety of plant and animal life.
As you explore the exhibits, you will learn about threatened and
endangered species that are under careful monitoring by
biologists. Protective conservation efforts are in place for
these vulnerable plants and animals. We welcome you to learn
more about these important species throughout the exhibits. Scan
the QR codes on display for more information.
</p>
</div>
<Link href="/siteMapPage">
<div className="px-4 py-2 mt-6 rounded-md border active:border-hunterGreen border-asparagus justify-start items-start inline-flex">
<p className="active:text-hunterGreen text-center text-asparagus font-bold font-['Lato'] leading-tight">
Go to Map
</p>
</div>
</Link>
<div className="mt-8 grid grid-cols-2 gap-16 pb-[6rem]">
{exhibits.map(exhibit => (
<Exhibit
title={exhibit.category || ''}
description={exhibit.description || ''}
image={exhibit.image || ''}
key={exhibit.id}
id={exhibit.id}
web
/>
))}
</div>
</div>
</div>
)}
</div>
);
}

export default App;
1 change: 0 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
};

/**
* @param root0 - Destructured object containing the properties.
* @param root0.children - The child elements to be rendered within the RootLayout component.
Expand Down
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import VisitorResources from '../components/userComponents/HomePageComponents/Vi
import WelcomeGraphic from '../components/userComponents/HomePageComponents/WelcomeGraphic/WelcomeGraphic';
import HomeVirtualTours from '../components/userComponents/HomePageComponents/HomeVirtualTours/HomeVirtualTours';
import HomeNewsFeed from '../components/userComponents/HomePageComponents/HomeNewsFeed/HomeNewsFeed';
import { useWebScreenDetection } from '../context/WindowWidthContext/WindowWidthContext';
import { useWebDeviceDetection } from '../context/WindowWidthContext/WindowWidthContext';

/**
* @returns - Home page for PHS/SPCA. Buttons are available for the major flows of the application from this page.
Expand All @@ -22,7 +22,7 @@ function Home() {
// window.removeEventListener('resize', handleResize);
// };
// }, []);
const isWebDevice = useWebScreenDetection();
const isWebDevice = useWebDeviceDetection();

return (
<div className="HomePage w-full h-full m-0 flex-col justify-center font-normal">
Expand Down
65 changes: 65 additions & 0 deletions src/components/userComponents/Exhibit/Exhibit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import React from 'react';
import Image from 'next/image';
import { useWebDeviceDetection } from '../../../context/WindowWidthContext/WindowWidthContext';

/**
*
* @param root0 passed in
* @param root0.title title of exhibit
* @param root0.description description of exhibit
* @param root0.image image
* @param root0.id id of exhibit
* @param root0.web
* @returns exhibit component
*/
export default function Exhibit({
title,
description,
image,
id,
}: {
title: string;
description: string;
image: string;
id: number;
}) {
const isWebDevice = useWebDeviceDetection();
return (
<div>
{!isWebDevice && (
<li key={id} id={`a${id}`}>
<div className="w-full px-4 py-8 bg-mint-cream rounded-lg flex-col justify-start items-start gap-2.5 inline-flex mt-6">
<div className="flex-col justify-start items-start gap-5 flex">
<div className="justify-start items-center gap-2 inline-flex">
<h2 className="text-night font-semibold leading-tight font-['Lato']">
{title}
</h2>
</div>
<p className="text-night leading-tight font-normal font-['Lato']">
{description}
</p>
<Image src={image} alt="Exhibit" width={354} height={150} />
</div>
</div>
</li>
)}
{isWebDevice && (
<div className="flex flex-col w-full px-8 py-16 bg-mint-cream rounded-lg flex-col justify-start items-start gap-2.5 mt-6">
<div className="justify-start items-start gap-5">
<div className="justify-start items-center gap-2">
<h1 className="text-hunter-green font-semibold leading-tight font-['Lato']">
{' '}
{title}
</h1>
</div>
<p className="text-night leading-tight font-normal mt-5 mb-5 font-['Lato']">
{description}
</p>
</div>
<Image src={image} alt="Exhibit" width={354} height={150} />
<div className="flex-grow" />
</div>
)}
</div>
);
}
Loading
Loading