Skip to content

Commit

Permalink
Merge branch 'main' into andrei/phs-25-home-screen-redo
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahhpeng authored Mar 16, 2024
2 parents 7ff2ec6 + f4bfd34 commit 2483e9a
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 181 deletions.
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
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run prettier
npm run update-types
npm run pre-commit
58 changes: 17 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint",
"tsc-check": "tsc --noEmit",
"pre-push": "npm run tsc-check && npm run lint && npm run prettier",
"pre-commit": "npm run update-types && (npm run tsc-check || true) && (npm run lint || true) && npm run prettier",
"prettier": "prettier --write .",
"update-types": "npx supabase gen types typescript --project-id 'qkkuacqtcsfjbnzmxmhk' > src/types/supabase.ts"
},
Expand Down
6 changes: 3 additions & 3 deletions src/app/featuredToursPage/[tourId]/[displayId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ export default function TourStopPage({
}`,
);
}
}
};

// Fetch the display media
const fetchDisplayMedia = async () => {
const displayMedia = await fetchImagesForDisplay(params.displayId);
setMedia(displayMedia);
}
};

getDisplay();
getLinks();
fetchDisplayMedia();
}, [params.displayId, params.tourId]);

return (
<div className="bg-[#ebf0e4] h-full">
<div className="bg-[ivory] min-h-screen">
<NavBar />
<h1 className="text-[#333333] text-3xl font-bold p-4">
{display && display.title}
Expand Down
6 changes: 3 additions & 3 deletions src/app/featuredToursPage/[tourId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ export default function TourStartPage({
</div>
</div>
</div>
<p className="p-4">{tour && tour.description}</p>
<h3 className="p-4 text-lg font-bold">In this tour</h3>
<p className="p-4 text-night">{tour && tour.description}</p>
<h3 className="p-4 text-lg font-bold text-night">In this tour</h3>
<ol className="px-12">
{tourDisplays.map(tourDisplay => (
<li key={tourDisplay.display_id}>
<div>
<div className="text-night">
<Link
href={`/featuredToursPage/${params.tourId}/${tourDisplay.display_id}`}
>
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function RootLayout({
/>
<script src="html5-qrcode.min.js" />
</head>

<body
className={`${inter.className} ${lato.className} ${manrope.className}`}
>
Expand Down
7 changes: 6 additions & 1 deletion src/app/spotlightPage/[spotlightId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import React, { useEffect, useState } from 'react';
import { TourRow, DisplayRow } from '../../../types/types';
import { fetchTour } from '../../../supabase/tours/queries';
import NavBar from '../../../components/userComponents/navBar/navBar';
import { fetchDisplayfromSpotlight } from '../../../supabase/tour_displays/queries';
import {
fetchDisplayfromSpotlight,
fetchRelatedSpotlightsfromSpotlightId,
} from '../../../supabase/tour_displays/queries';

/**
* @param -.params
Expand Down Expand Up @@ -45,8 +48,10 @@ export default function Page({ params }: { params: { spotlightId: string } }) {
const responseDataForDisplays: DisplayRow[] =
await fetchDisplayfromSpotlight(params.spotlightId);
setDisplays(responseDataForDisplays);

// const responseDataForRelatedSpotlights: TourRow[] = await fetchRelatedSpotlightsfromSpotlightId(params.spotlightId);
// setRelatedSpotlight(responseDataForRelatedSpotlights);

} catch (error) {
console.error(error);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/userComponents/ImageScroller/ImageScroller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export default function Carousel({ media }: CarouselProps) {
setCurrentIndex(prevIndex =>
prevIndex === 0 ? media.length - 1 : prevIndex - 1,
);
}
};

// Goes to next image
const goToNext = () => {
setCurrentIndex(prevIndex =>
prevIndex === media.length - 1 ? 0 : prevIndex + 1,
);
}
};

return (
<div className="w-full flex overflow-x-auto justify-center align-center">
Expand Down
Loading

0 comments on commit 2483e9a

Please sign in to comment.