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