diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..4235a8f7
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -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
diff --git a/.husky/pre-commit b/.husky/pre-commit
index a0843e8b..d4a43dd1 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1,5 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
-npm run prettier
-npm run update-types
+npm run pre-commit
diff --git a/package-lock.json b/package-lock.json
index 0ee55d24..2501ddfa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -22,7 +22,6 @@
"react-dom": "latest",
"react-icons": "^4.12.0",
"react-leaflet": "^4.2.1",
- "react-qr-scanner": "^1.0.0-alpha.11",
"react-responsive-carousel": "^3.2.23",
"slick-carousel": "^1.8.1"
},
@@ -902,25 +901,11 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
- "node_modules/@zxing/library": {
- "version": "0.19.3",
- "resolved": "https://registry.npmjs.org/@zxing/library/-/library-0.19.3.tgz",
- "integrity": "sha512-RUv5svewpDoD0ymXleOP8yVTO5BLkR0zn5coGC/Vs1671u0OBJ4xdtR8WVWf08OcvrieEMHdSfQY3ZKtqII/hg==",
- "dependencies": {
- "ts-custom-error": "^3.2.1"
- },
- "engines": {
- "node": ">= 10.4.0"
- },
- "optionalDependencies": {
- "@zxing/text-encoding": "~0.9.0"
- }
- },
- "node_modules/@zxing/text-encoding": {
- "version": "0.9.0",
- "resolved": "https://registry.npmjs.org/@zxing/text-encoding/-/text-encoding-0.9.0.tgz",
- "integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==",
- "optional": true
+ "node_modules/@ungap/structured-clone": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
+ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
+ "dev": true
},
"node_modules/acorn": {
"version": "8.11.2",
@@ -3159,6 +3144,18 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+ "dev": true,
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/html5-qrcode": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/html5-qrcode/-/html5-qrcode-2.3.8.tgz",
@@ -4928,19 +4925,6 @@
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
},
- "node_modules/react-qr-scanner": {
- "version": "1.0.0-alpha.11",
- "resolved": "https://registry.npmjs.org/react-qr-scanner/-/react-qr-scanner-1.0.0-alpha.11.tgz",
- "integrity": "sha512-TdaygL+4U9iapskJgK5Ilb1Cw4wwzQ3bVpIfzzbrEsxPaEJzmjQ7VuMz8E9hBQGCU4Ee+YtgglE3byEtgtRpkA==",
- "dependencies": {
- "@zxing/library": "^0.19.1",
- "prop-types": "^15.8.1"
- },
- "peerDependencies": {
- "react": "^17.0.0 || ^18.0.0",
- "react-dom": "^17.0.0 || ^18.0.0"
- }
- },
"node_modules/react-responsive-carousel": {
"version": "3.2.23",
"resolved": "https://registry.npmjs.org/react-responsive-carousel/-/react-responsive-carousel-3.2.23.tgz",
@@ -5761,14 +5745,6 @@
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
- "node_modules/ts-custom-error": {
- "version": "3.3.1",
- "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz",
- "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==",
- "engines": {
- "node": ">=14.0.0"
- }
- },
"node_modules/ts-interface-checker": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
diff --git a/package.json b/package.json
index 0df2d897..2d5ddbe8 100644
--- a/package.json
+++ b/package.json
@@ -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"
},
diff --git a/src/app/featuredToursPage/[tourId]/[displayId]/page.tsx b/src/app/featuredToursPage/[tourId]/[displayId]/page.tsx
index 9b0d0a26..8bed0b84 100644
--- a/src/app/featuredToursPage/[tourId]/[displayId]/page.tsx
+++ b/src/app/featuredToursPage/[tourId]/[displayId]/page.tsx
@@ -78,13 +78,13 @@ export default function TourStopPage({
}`,
);
}
- }
+ };
// Fetch the display media
const fetchDisplayMedia = async () => {
const displayMedia = await fetchImagesForDisplay(params.displayId);
setMedia(displayMedia);
- }
+ };
getDisplay();
getLinks();
@@ -92,7 +92,7 @@ export default function TourStopPage({
}, [params.displayId, params.tourId]);
return (
-
+
{display && display.title}
diff --git a/src/app/featuredToursPage/[tourId]/page.tsx b/src/app/featuredToursPage/[tourId]/page.tsx
index 248d6da8..8fbe0166 100644
--- a/src/app/featuredToursPage/[tourId]/page.tsx
+++ b/src/app/featuredToursPage/[tourId]/page.tsx
@@ -75,12 +75,12 @@ export default function TourStartPage({
- {tour && tour.description}
- In this tour
+ {tour && tour.description}
+ In this tour
{tourDisplays.map(tourDisplay => (
-
-
+
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 36c65d17..6ed8e001 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -44,7 +44,7 @@ export default function RootLayout({
/>
-
+
diff --git a/src/app/spotlightPage/[spotlightId]/page.tsx b/src/app/spotlightPage/[spotlightId]/page.tsx
index 368a45fc..3a33f819 100644
--- a/src/app/spotlightPage/[spotlightId]/page.tsx
+++ b/src/app/spotlightPage/[spotlightId]/page.tsx
@@ -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
@@ -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);
}
diff --git a/src/components/userComponents/ImageScroller/ImageScroller.tsx b/src/components/userComponents/ImageScroller/ImageScroller.tsx
index 189720b6..ae20ffb1 100644
--- a/src/components/userComponents/ImageScroller/ImageScroller.tsx
+++ b/src/components/userComponents/ImageScroller/ImageScroller.tsx
@@ -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 (
diff --git a/src/types/supabase.ts b/src/types/supabase.ts
index 878f279a..38051f97 100644
--- a/src/types/supabase.ts
+++ b/src/types/supabase.ts
@@ -4,61 +4,80 @@ export type Json =
| boolean
| null
| { [key: string]: Json | undefined }
- | Json[]
+ | Json[];
export type Database = {
public: {
Tables: {
display_media: {
Row: {
- display_id: string
- media_id: string
- media_placement: string | null
- }
+ display_id: string;
+ media_id: string;
+ media_placement: string | null;
+ };
Insert: {
- display_id: string
- media_id: string
- media_placement?: string | null
- }
+ display_id: string;
+ media_id: string;
+ media_placement?: string | null;
+ };
Update: {
- display_id?: string
- media_id?: string
- media_placement?: string | null
- }
+ display_id?: string;
+ media_id?: string;
+ media_placement?: string | null;
+ };
Relationships: [
{
- foreignKeyName: "display_media_display_id_fkey"
- columns: ["display_id"]
- isOneToOne: false
- referencedRelation: "displays"
- referencedColumns: ["id"]
+ foreignKeyName: 'display_media_display_id_fkey';
+ columns: ['display_id'];
+ isOneToOne: false;
+ referencedRelation: 'displays';
+ referencedColumns: ['id'];
},
{
- foreignKeyName: "display_media_media_id_fkey"
- columns: ["media_id"]
- isOneToOne: false
- referencedRelation: "media"
- referencedColumns: ["id"]
- }
- ]
- }
+ foreignKeyName: 'display_media_media_id_fkey';
+ columns: ['media_id'];
+ isOneToOne: false;
+ referencedRelation: 'media';
+ referencedColumns: ['id'];
+ },
+ ];
+ };
displays: {
Row: {
- coordinates: Json | null
- created_at: string
- description: string
- id: string
- title: string
- updated_at: string | null
- }
+ coordinates: Json | null;
+ created_at: string;
+ description: string;
+ id: string;
+ title: string;
+ updated_at: string | null;
+ };
Insert: {
- coordinates?: Json | null
- created_at?: string
- description?: string
- id: string
- title?: string
- updated_at?: string | null
- }
+ coordinates?: Json | null;
+ created_at?: string;
+ description?: string;
+ id: string;
+ title?: string;
+ updated_at?: string | null;
+ };
+ Update: {
+ coordinates?: Json | null;
+ created_at?: string;
+ description?: string;
+ id?: string;
+ title?: string;
+ updated_at?: string | null;
+ };
+ Relationships: [];
+ };
+ emails: {
+ Row: {
+ emails: string | null;
+ id: number;
+ };
+ Insert: {
+ emails?: string | null;
+ id?: number;
+ };
Update: {
coordinates?: Json | null
created_at?: string
@@ -86,21 +105,21 @@ export type Database = {
}
media: {
Row: {
- created_at: string
- id: string
- text: string | null
- title: string | null
- type: string | null
- url: string
- }
+ created_at: string;
+ id: string;
+ text: string | null;
+ title: string | null;
+ type: string | null;
+ url: string;
+ };
Insert: {
- created_at?: string
- id?: string
- text?: string | null
- title?: string | null
- type?: string | null
- url?: string
- }
+ created_at?: string;
+ id?: string;
+ text?: string | null;
+ title?: string | null;
+ type?: string | null;
+ url?: string;
+ };
Update: {
created_at?: string
id?: string
@@ -137,97 +156,97 @@ export type Database = {
}
spotlight_recommendations: {
Row: {
- source_display_id: string
- target_display_id: string
- }
+ source_display_id: string;
+ target_display_id: string;
+ };
Insert: {
- source_display_id: string
- target_display_id: string
- }
+ source_display_id: string;
+ target_display_id: string;
+ };
Update: {
- source_display_id?: string
- target_display_id?: string
- }
+ source_display_id?: string;
+ target_display_id?: string;
+ };
Relationships: [
{
- foreignKeyName: "spotlight_recommendations_source_display_id_fkey"
- columns: ["source_display_id"]
- isOneToOne: false
- referencedRelation: "tours"
- referencedColumns: ["id"]
+ foreignKeyName: 'spotlight_recommendations_source_display_id_fkey';
+ columns: ['source_display_id'];
+ isOneToOne: false;
+ referencedRelation: 'tours';
+ referencedColumns: ['id'];
},
{
- foreignKeyName: "spotlight_recommendations_target_display_id_fkey"
- columns: ["target_display_id"]
- isOneToOne: false
- referencedRelation: "tours"
- referencedColumns: ["id"]
- }
- ]
- }
+ foreignKeyName: 'spotlight_recommendations_target_display_id_fkey';
+ columns: ['target_display_id'];
+ isOneToOne: false;
+ referencedRelation: 'tours';
+ referencedColumns: ['id'];
+ },
+ ];
+ };
tour_displays: {
Row: {
- display_id: string
- display_order: number | null
- tour_id: string
- }
+ display_id: string;
+ display_order: number | null;
+ tour_id: string;
+ };
Insert: {
- display_id: string
- display_order?: number | null
- tour_id: string
- }
+ display_id: string;
+ display_order?: number | null;
+ tour_id: string;
+ };
Update: {
- display_id?: string
- display_order?: number | null
- tour_id?: string
- }
+ display_id?: string;
+ display_order?: number | null;
+ tour_id?: string;
+ };
Relationships: [
{
- foreignKeyName: "tour_displays_display_id_fkey"
- columns: ["display_id"]
- isOneToOne: false
- referencedRelation: "displays"
- referencedColumns: ["id"]
+ foreignKeyName: 'tour_displays_display_id_fkey';
+ columns: ['display_id'];
+ isOneToOne: false;
+ referencedRelation: 'displays';
+ referencedColumns: ['id'];
},
{
- foreignKeyName: "tour_displays_tour_id_fkey"
- columns: ["tour_id"]
- isOneToOne: false
- referencedRelation: "tours"
- referencedColumns: ["id"]
- }
- ]
- }
+ foreignKeyName: 'tour_displays_tour_id_fkey';
+ columns: ['tour_id'];
+ isOneToOne: false;
+ referencedRelation: 'tours';
+ referencedColumns: ['id'];
+ },
+ ];
+ };
tour_media: {
Row: {
- media_id: string
- tour_id: string
- }
+ media_id: string;
+ tour_id: string;
+ };
Insert: {
- media_id: string
- tour_id: string
- }
+ media_id: string;
+ tour_id: string;
+ };
Update: {
- media_id?: string
- tour_id?: string
- }
+ media_id?: string;
+ tour_id?: string;
+ };
Relationships: [
{
- foreignKeyName: "tour_media_media_id_fkey"
- columns: ["media_id"]
- isOneToOne: false
- referencedRelation: "media"
- referencedColumns: ["id"]
+ foreignKeyName: 'tour_media_media_id_fkey';
+ columns: ['media_id'];
+ isOneToOne: false;
+ referencedRelation: 'media';
+ referencedColumns: ['id'];
},
{
- foreignKeyName: "tour_media_tour_id_fkey"
- columns: ["tour_id"]
- isOneToOne: false
- referencedRelation: "tours"
- referencedColumns: ["id"]
- }
- ]
- }
+ foreignKeyName: 'tour_media_tour_id_fkey';
+ columns: ['tour_id'];
+ isOneToOne: false;
+ referencedRelation: 'tours';
+ referencedColumns: ['id'];
+ },
+ ];
+ };
tours: {
Row: {
category: Database["public"]["Enums"]["tour_category"]
@@ -266,8 +285,8 @@ export type Database = {
}
}
Views: {
- [_ in never]: never
- }
+ [_ in never]: never;
+ };
Functions: {
fetchimagesfordisplay: {
Args: {
@@ -332,7 +351,31 @@ export type Database = {
| "SiteFeatures"
}
CompositeTypes: {
- [_ in never]: never
+ [_ in never]: never;
+ };
+ };
+};
+
+export type Tables<
+ PublicTableNameOrOptions extends
+ | keyof (Database['public']['Tables'] & Database['public']['Views'])
+ | { schema: keyof Database },
+ TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
+ ? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] &
+ Database[PublicTableNameOrOptions['schema']]['Views'])
+ : never = never,
+> = PublicTableNameOrOptions extends { schema: keyof Database }
+ ? (Database[PublicTableNameOrOptions['schema']]['Tables'] &
+ Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends {
+ Row: infer R;
+ }
+ ? R
+ : never
+ : PublicTableNameOrOptions extends keyof (Database['public']['Tables'] &
+ Database['public']['Views'])
+ ? (Database['public']['Tables'] &
+ Database['public']['Views'])[PublicTableNameOrOptions] extends {
+ Row: infer R;
}
}
}
@@ -415,4 +458,4 @@ export type Enums<
? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
: PublicEnumNameOrOptions extends keyof Database["public"]["Enums"]
? Database["public"]["Enums"][PublicEnumNameOrOptions]
- : never
+ : never
\ No newline at end of file
diff --git a/src/types/types.ts b/src/types/types.ts
index 84badfa9..520f1571 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -12,4 +12,4 @@ export type TourDisplaysRow =
Database['public']['Tables']['tour_displays']['Row'];
export type TourMediaRow = Database['public']['Tables']['tour_media']['Row'];
export type TourRow = Database['public']['Tables']['tours']['Row'];
-export type SpotlightWithMediaRow = TourRow & { media_url: string };
+export type SpotlightWithMediaRow = TourRow & { media_url: string };
\ No newline at end of file