Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ PublishScripts/
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# **/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# !**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
Expand Down
43 changes: 43 additions & 0 deletions packages/CourtBooking/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# certificates
*.pem

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

# Ignore TanStack Router temp
.tanstack/tmp/

# Ignore Vite cache
.vite/
15 changes: 15 additions & 0 deletions packages/CourtBooking/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# courtbooking

To install dependencies:

```bash
bun install
```

To run:

```bash
bun run index.ts
```

This project was created using `bun init` in bun v1.2.18. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
1,631 changes: 1,631 additions & 0 deletions packages/CourtBooking/bun.lock

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions packages/CourtBooking/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "courtbooking",
"type": "module",
"private": true,
"scripts": {
"dev": "vite dev",
"start": "vite start",
"build": "vite build",
"check": "tsc --noEmit && eslint",
"clean": "rm -rf dist bun.lockb"
},
"devDependencies": {
"@tanstack/router-plugin": "^1.127.5",
"@types/bun": "latest",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"vite-tsconfig-paths": "^5.1.4"
},
"peerDependencies": {
"typescript": "^5.8.3"
},
"dependencies": {
"@tailwindcss/vite": "^4.1.11",
"@tanstack/react-router": "^1.127.3",
"@tanstack/react-router-devtools": "^1.127.3",
"@tanstack/react-start": "^1.127.7",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"tailwindcss": "^4.1.11",
"vite": "^7.0.4"
}
}
53 changes: 53 additions & 0 deletions packages/CourtBooking/src/components/DefaultCatchBoundary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {
ErrorComponent,
Link,
rootRouteId,
useMatch,
useRouter,
} from '@tanstack/react-router';
import type { ErrorComponentProps } from '@tanstack/react-router';

export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
const router = useRouter();
const isRoot = useMatch({

Check warning on line 12 in packages/CourtBooking/src/components/DefaultCatchBoundary.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/components/DefaultCatchBoundary.tsx#L12

Unsafe assignment of an error typed value.

Check warning on line 12 in packages/CourtBooking/src/components/DefaultCatchBoundary.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/components/DefaultCatchBoundary.tsx#L12

Unsafe call of an `error` type typed value.
strict: false,
select: (state) => state.id === rootRouteId,
});

console.error('DefaultCatchBoundary Error:', error);

return (
<div className='min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6'>
<ErrorComponent error={error} />
<div className='flex gap-2 items-center flex-wrap'>
<button
onClick={() => {
router.invalidate();

Check warning on line 25 in packages/CourtBooking/src/components/DefaultCatchBoundary.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/components/DefaultCatchBoundary.tsx#L25

Unsafe member access .invalidate on an `error` typed value.
}}
className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}
>
Try Again
</button>
{isRoot ? (
<Link
to='/'
className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}
>
Home
</Link>
) : (
<Link
to='/'
className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}
onClick={(e) => {
e.preventDefault();

Check warning on line 43 in packages/CourtBooking/src/components/DefaultCatchBoundary.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/components/DefaultCatchBoundary.tsx#L43

Unsafe member access .preventDefault on an `any` value.
window.history.back();
}}
>
Go Back
</Link>
)}
</div>
</div>
);
}
25 changes: 25 additions & 0 deletions packages/CourtBooking/src/components/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Link } from '@tanstack/react-router';

export function NotFound({ children }: { children?: any }) {

Check warning on line 3 in packages/CourtBooking/src/components/NotFound.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/components/NotFound.tsx#L3

Unexpected any. Specify a different type.
return (
<div className='space-y-2 p-2'>
<div className='text-gray-600 dark:text-gray-400'>
{children || <p>The page you are looking for does not exist.</p>}
</div>
<p className='flex items-center gap-2 flex-wrap'>
<button
onClick={() => window.history.back()}

Check warning on line 11 in packages/CourtBooking/src/components/NotFound.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/components/NotFound.tsx#L11

Returning a void expression from an arrow function shorthand is forbidden. Please add braces to the arrow function.
className='bg-emerald-500 text-white px-2 py-1 rounded uppercase font-black text-sm'
>
Go back
</button>
<Link
to='/'
className='bg-cyan-600 text-white px-2 py-1 rounded uppercase font-black text-sm'
>
Start Over
</Link>
</p>
</div>
);
}
27 changes: 27 additions & 0 deletions packages/CourtBooking/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
import { RouterProvider, createRouter } from '@tanstack/react-router';

// Import the generated route tree
import { routeTree } from './routeTree.gen';

// Create a new router instance
const router = createRouter({ routeTree });

Check warning on line 9 in packages/CourtBooking/src/main.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/main.tsx#L9

Unsafe assignment of an error typed value.

// Register the router instance for type safety
declare module '@tanstack/react-router' {
interface Register {
router: typeof router;
}
}

// Render the app
const rootElement = document.getElementById('root')!;

Check warning on line 19 in packages/CourtBooking/src/main.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/main.tsx#L19

Forbidden non-null assertion.
if (!rootElement.innerHTML) {
const root = ReactDOM.createRoot(rootElement);

Check warning on line 21 in packages/CourtBooking/src/main.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/main.tsx#L21

Unsafe assignment of an error typed value.

Check warning on line 21 in packages/CourtBooking/src/main.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/main.tsx#L21

Unsafe member access .createRoot on an `error` typed value.
root.render(

Check warning on line 22 in packages/CourtBooking/src/main.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/main.tsx#L22

Unsafe call of an `error` type typed value.

Check warning on line 22 in packages/CourtBooking/src/main.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/main.tsx#L22

Unsafe member access .render on an `error` typed value.
<StrictMode>
<RouterProvider router={router} />
</StrictMode>
);
}
77 changes: 77 additions & 0 deletions packages/CourtBooking/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* eslint-disable */

// @ts-nocheck

// noinspection JSUnusedGlobalSymbols

// This file was automatically generated by TanStack Router.
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.

import { Route as rootRouteImport } from './routes/__root'
import { Route as AboutRouteImport } from './routes/about'
import { Route as IndexRouteImport } from './routes/index'

const AboutRoute = AboutRouteImport.update({
id: '/about',
path: '/about',
getParentRoute: () => rootRouteImport,
} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)

export interface FileRoutesByFullPath {
'/': typeof IndexRoute
'/about': typeof AboutRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
'/about': typeof AboutRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
'/about': typeof AboutRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/' | '/about'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/about'
id: '__root__' | '/' | '/about'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
AboutRoute: typeof AboutRoute
}

declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/about': {
id: '/about'
path: '/about'
fullPath: '/about'
preLoaderRoute: typeof AboutRouteImport
parentRoute: typeof rootRouteImport
}
'/': {
id: '/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
}
}

const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
AboutRoute: AboutRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
22 changes: 22 additions & 0 deletions packages/CourtBooking/src/router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// src/router.tsx
import { createRouter as createTanStackRouter } from '@tanstack/react-router';
import { routeTree } from './routeTree.gen';
import { NotFound } from './components/NotFound';
import { DefaultCatchBoundary } from './components/DefaultCatchBoundary';

export function createRouter() {
const router = createTanStackRouter({

Check warning on line 8 in packages/CourtBooking/src/router.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/router.tsx#L8

Unsafe assignment of an error typed value.

Check warning on line 8 in packages/CourtBooking/src/router.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/router.tsx#L8

Unsafe call of an `error` type typed value.
routeTree,
defaultErrorComponent: DefaultCatchBoundary,
defaultNotFoundComponent: () => <NotFound />,
scrollRestoration: true,
});

return router;

Check warning on line 15 in packages/CourtBooking/src/router.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/router.tsx#L15

Unsafe return of an error typed value.
}

declare module '@tanstack/react-router' {
interface Register {
router: ReturnType<typeof createRouter>;
}
}
51 changes: 51 additions & 0 deletions packages/CourtBooking/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/// <reference types="vite/client" />

import {
Outlet,
createRootRoute,
HeadContent,
Scripts,
} from '@tanstack/react-router';
import appCss from '../styles/app.css?url';
import type { ReactNode } from 'react';

export const Route = createRootRoute({

Check warning on line 12 in packages/CourtBooking/src/routes/__root.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/routes/__root.tsx#L12

Unsafe assignment of an error typed value.
head: () => ({
meta: [
{
charSet: 'utf-8',
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
{
title: 'TanStack Start Starter',
},
],
links: [{ rel: 'stylesheet', href: appCss }],
}),
component: RootComponent,
});

function RootComponent() {
return (
<RootDocument>
<Outlet />
</RootDocument>
);
}

function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
return (
<html>
<head>
<HeadContent />
</head>
<body>
{children}
<Scripts />
</body>
</html>
);
}
9 changes: 9 additions & 0 deletions packages/CourtBooking/src/routes/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/about')({

Check warning on line 3 in packages/CourtBooking/src/routes/about.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/routes/about.tsx#L3

Unsafe call of an `error` type typed value.
component: About,
});

function About() {
return <div className='text-blue-500'>Hello from About!</div>;
}
9 changes: 9 additions & 0 deletions packages/CourtBooking/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/')({

Check warning on line 3 in packages/CourtBooking/src/routes/index.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

packages/CourtBooking/src/routes/index.tsx#L3

Unsafe call of an `error` type typed value.
component: Index,
});

function Index() {
return <div className='bg-red-500 text-white p-4'>Hello World</div>;
}
Loading
Loading