mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Reorganise code - use src folder
This commit is contained in:
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Use type safe message keys with `next-intl`
|
||||
type Messages = typeof import("./messages/fr.json");
|
||||
type Messages = typeof import("./src/messages/fr.json");
|
||||
|
||||
declare interface IntlMessages extends Messages {}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
||||
enabled: process.env.ANALYZE === "true",
|
||||
});
|
||||
|
||||
const withNextIntl = require("next-intl/plugin")("./i18n.ts");
|
||||
const withNextIntl = require("next-intl/plugin")("./src/i18n.ts");
|
||||
|
||||
const withPWA = require("next-pwa")({
|
||||
dest: "public",
|
||||
|
||||
@@ -10,7 +10,7 @@ import "leaflet/dist/leaflet.css";
|
||||
import { useFormContext, useWatch } from "react-hook-form";
|
||||
import { MapContainer, Marker, TileLayer } from "react-leaflet";
|
||||
|
||||
import { mapBoundsAtom } from "@/app/atoms";
|
||||
import { mapBoundsAtom } from "@/atoms";
|
||||
import MapEvents from "@/components/MapEvents";
|
||||
|
||||
const center: LatLngLiteral = { lat: 47.0844, lng: 2.3964 };
|
||||
@@ -10,7 +10,7 @@ import "leaflet.smooth_marker_bouncing";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import { countBy, groupBy } from "lodash";
|
||||
|
||||
import { clubsAtom } from "@/app/atoms";
|
||||
import { clubsAtom } from "@/atoms";
|
||||
import { Map, MapMarker } from "@/components/Map";
|
||||
|
||||
import { ClubMarker } from "./ClubMarker";
|
||||
@@ -6,9 +6,9 @@ import { useSetAtom } from "jotai";
|
||||
import L from "leaflet";
|
||||
import { Marker, MarkerProps, Popup } from "react-leaflet";
|
||||
|
||||
import { debouncedHoveredMapIdAtom } from "@/app/atoms";
|
||||
import { TimeControlColours } from "@/app/constants";
|
||||
import { debouncedHoveredMapIdAtom } from "@/atoms";
|
||||
import type { MarkerRef } from "@/components/Map";
|
||||
import { TimeControlColours } from "@/constants";
|
||||
import type { BouncingMarker } from "@/leafletTypes";
|
||||
import { Club } from "@/types";
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
filteredClubsListAtom,
|
||||
hoveredMapIdAtom,
|
||||
syncVisibleAtom,
|
||||
} from "@/app/atoms";
|
||||
} from "@/atoms";
|
||||
import ScrollToTopButton from "@/components/ScrollToTopButton";
|
||||
import SearchBar from "@/components/SearchBar";
|
||||
import { useBreakpoint } from "@/hooks/tailwind";
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useHydrateAtoms } from "jotai/utils";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
import { clubsAtom } from "@/app/atoms";
|
||||
import { clubsAtom } from "@/atoms";
|
||||
import LoadingMap from "@/components/LoadingMap";
|
||||
import { Club } from "@/types";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useAtom } from "jotai";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import { burgerMenuIsOpenAtom } from "@/app/atoms";
|
||||
import { burgerMenuIsOpenAtom } from "@/atoms";
|
||||
|
||||
import HamburgerMenu from "./HamburgerMenu";
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { useAtom } from "jotai";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import { burgerMenuIsOpenAtom } from "@/app/atoms";
|
||||
import { burgerMenuIsOpenAtom } from "@/atoms";
|
||||
import { Link } from "@/utils/navigation";
|
||||
|
||||
const HamburgerMenu = () => {
|
||||
@@ -7,8 +7,7 @@ import { notFound } from "next/navigation";
|
||||
import Script from "next/script";
|
||||
|
||||
import "@/css/globals.css";
|
||||
|
||||
import Providers from "../providers";
|
||||
import Providers from "@/providers";
|
||||
|
||||
import Footer from "./components/Footer";
|
||||
import Navbar from "./components/Navbar";
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useTranslations } from "next-intl";
|
||||
import Image from "next/image";
|
||||
|
||||
import bgImage from "@/public/images/map-bg.jpg";
|
||||
import bgImage from "@/img/map-bg.jpg";
|
||||
import { Link } from "@/utils/navigation";
|
||||
|
||||
export default function Home() {
|
||||
@@ -5,8 +5,8 @@ import L from "leaflet";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useMap } from "react-leaflet";
|
||||
|
||||
import { filteredTournamentsByTimeControlAtom } from "@/app/atoms";
|
||||
import { TimeControlColours } from "@/app/constants";
|
||||
import { filteredTournamentsByTimeControlAtom } from "@/atoms";
|
||||
import { TimeControlColours } from "@/constants";
|
||||
import { TimeControl } from "@/types";
|
||||
|
||||
const Legend = () => {
|
||||
+1
-1
@@ -7,7 +7,7 @@ import {
|
||||
otherAtom,
|
||||
rapidAtom,
|
||||
tournamentsAtom,
|
||||
} from "@/app/atoms";
|
||||
} from "@/atoms";
|
||||
import { TimeControl } from "@/types";
|
||||
|
||||
const TimeControlFilters = () => {
|
||||
+2
-5
@@ -10,12 +10,9 @@ import "leaflet.smooth_marker_bouncing";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import { countBy, groupBy } from "lodash";
|
||||
|
||||
import {
|
||||
filteredTournamentsByTimeControlAtom,
|
||||
normsOnlyAtom,
|
||||
} from "@/app/atoms";
|
||||
import { TimeControlColours } from "@/app/constants";
|
||||
import { filteredTournamentsByTimeControlAtom, normsOnlyAtom } from "@/atoms";
|
||||
import { Map, MapMarker } from "@/components/Map";
|
||||
import { TimeControlColours } from "@/constants";
|
||||
import { generatePieSVG } from "@/lib/pie";
|
||||
import { TimeControl } from "@/types";
|
||||
|
||||
+2
-2
@@ -9,9 +9,9 @@ import { useTranslations } from "next-intl";
|
||||
import { FaTrophy } from "react-icons/fa";
|
||||
import { Marker, MarkerProps, Popup } from "react-leaflet";
|
||||
|
||||
import { debouncedHoveredMapIdAtom } from "@/app/atoms";
|
||||
import { TimeControlColours } from "@/app/constants";
|
||||
import { debouncedHoveredMapIdAtom } from "@/atoms";
|
||||
import type { MarkerRef } from "@/components/Map";
|
||||
import { TimeControlColours } from "@/constants";
|
||||
import type { BouncingMarker } from "@/leafletTypes";
|
||||
import { Tournament } from "@/types";
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import {
|
||||
hoveredMapIdAtom,
|
||||
normsOnlyAtom,
|
||||
syncVisibleAtom,
|
||||
} from "@/app/atoms";
|
||||
} from "@/atoms";
|
||||
import ScrollToTopButton from "@/components/ScrollToTopButton";
|
||||
import SearchBar from "@/components/SearchBar";
|
||||
import { useBreakpoint } from "@/hooks/tailwind";
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import { useHydrateAtoms } from "jotai/utils";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
import { tournamentsAtom } from "@/app/atoms";
|
||||
import { tournamentsAtom } from "@/atoms";
|
||||
import LoadingMap from "@/components/LoadingMap";
|
||||
import { Tournament } from "@/types";
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
fetchRequestHandler,
|
||||
} from "@trpc/server/adapters/fetch";
|
||||
|
||||
import { appRouter } from "@/app/server/appRouter";
|
||||
import { appRouter } from "@/server/appRouter";
|
||||
|
||||
const handler = (request: Request) => {
|
||||
return fetchRequestHandler({
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
@@ -18,7 +18,7 @@ import { FaAngleDoubleDown } from "react-icons/fa";
|
||||
import { LayerGroup, MapContainer, TileLayer } from "react-leaflet";
|
||||
import MarkerClusterGroup from "react-leaflet-cluster";
|
||||
|
||||
import { debouncedHoveredListIdAtom, mapBoundsAtom } from "@/app/atoms";
|
||||
import { debouncedHoveredListIdAtom, mapBoundsAtom } from "@/atoms";
|
||||
import MapEvents from "@/components/MapEvents";
|
||||
|
||||
export type MarkerRef = {
|
||||
@@ -4,7 +4,7 @@ import { useSetAtom } from "jotai";
|
||||
import L from "leaflet";
|
||||
import { useMapEvent } from "react-leaflet";
|
||||
|
||||
import { mapBoundsAtom } from "@/app/atoms";
|
||||
import { mapBoundsAtom } from "@/atoms";
|
||||
|
||||
const MapEvents = () => {
|
||||
const setMapBounds = useSetAtom(mapBoundsAtom);
|
||||
@@ -4,7 +4,7 @@ import { useAtom } from "jotai/index";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { IoCloseOutline } from "react-icons/io5";
|
||||
|
||||
import { searchStringAtom } from "@/app/atoms";
|
||||
import { searchStringAtom } from "@/atoms";
|
||||
|
||||
const SearchBar = () => {
|
||||
const t = useTranslations("Tournaments");
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import resolveConfig from "tailwindcss/resolveConfig";
|
||||
|
||||
import tailwindConfig from "@/tailwind.config.js";
|
||||
import tailwindConfig from "@/../tailwind.config.js";
|
||||
|
||||
const config = resolveConfig(tailwindConfig);
|
||||
|
||||
@@ -22,7 +22,7 @@ function useDarkMode(): [string, Dispatch<SetStateAction<string>>] {
|
||||
if (typeof window !== "undefined") {
|
||||
localStorage.setItem("theme", theme);
|
||||
}
|
||||
}, [theme]);
|
||||
}, [colorTheme, theme]);
|
||||
|
||||
return [colorTheme, setTheme];
|
||||
}
|
||||
|
Before Width: | Height: | Size: 515 KiB After Width: | Height: | Size: 515 KiB |
@@ -1,6 +1,6 @@
|
||||
import createMiddleware from "next-intl/middleware";
|
||||
|
||||
import { locales, pathnames } from "@/utils//navigation";
|
||||
import { locales, pathnames } from "@/utils/navigation";
|
||||
|
||||
export default createMiddleware({
|
||||
defaultLocale: "fr",
|
||||
@@ -31,7 +31,7 @@ export const addTournament = publicProcedure
|
||||
coordinates: tournament.coordinates as [number, number],
|
||||
entry_method: "manual",
|
||||
pending: true,
|
||||
status: 'scheduled'
|
||||
status: "scheduled",
|
||||
};
|
||||
|
||||
const result = await db.insertOne(tournamentData);
|
||||
@@ -39,8 +39,12 @@ export const addTournament = publicProcedure
|
||||
if (result.insertedId) {
|
||||
const { tournament, country, date, time_control } = tournamentData;
|
||||
|
||||
if (typeof process.env.DISCORD_WEBHOOK_ADD_TOURNAMENT_URL === "string") {
|
||||
await fetch(process.env.DISCORD_WEBHOOK_ADD_TOURNAMENT_URL as string, {
|
||||
if (
|
||||
typeof process.env.DISCORD_WEBHOOK_ADD_TOURNAMENT_URL === "string"
|
||||
) {
|
||||
await fetch(
|
||||
process.env.DISCORD_WEBHOOK_ADD_TOURNAMENT_URL as string,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -64,7 +68,8 @@ export const addTournament = publicProcedure
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
+5
-5
@@ -118,18 +118,18 @@ export const fetchTournamentResults = publicProcedure
|
||||
throw new Error("ERR_NO_TOURNAMENT_ID");
|
||||
}
|
||||
|
||||
const headers = new Headers()
|
||||
const apiKey = process.env.RESULTS_API_KEY
|
||||
const headers = new Headers();
|
||||
const apiKey = process.env.RESULTS_API_KEY;
|
||||
|
||||
if (apiKey) {
|
||||
headers.append('api-key', apiKey)
|
||||
headers.append("api-key", apiKey);
|
||||
}
|
||||
|
||||
const rawResults = await fetch(
|
||||
`${process.env.RESULTS_SCRAPER_URL}${tournamentId}`,
|
||||
{
|
||||
headers: headers
|
||||
}
|
||||
headers: headers,
|
||||
},
|
||||
);
|
||||
|
||||
const results = await rawResults.json();
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createTRPCReact } from "@trpc/react-query";
|
||||
import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
|
||||
|
||||
import type { AppRouter } from "@/app/server/appRouter";
|
||||
import type { AppRouter } from "@/server/appRouter";
|
||||
|
||||
export type APIRouterInput = inferRouterInputs<AppRouter>;
|
||||
export type APIRouterOutput = inferRouterOutputs<AppRouter>;
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
module.exports = {
|
||||
darkMode: "class",
|
||||
content: [
|
||||
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
|
||||
Reference in New Issue
Block a user