initial-commit

This commit is contained in:
Dhaverd 2025-08-26 11:00:27 +08:00
commit 34ad61bd8c
30 changed files with 5905 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Themesberg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

54
README.md Normal file
View File

@ -0,0 +1,54 @@
# React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default tseslint.config({
extends: [
// Remove ...tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
// other options...
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
tsconfigRootDir: import.meta.dirname,
},
},
});
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
```js
// eslint.config.js
import reactX from "eslint-plugin-react-x";
import reactDom from "eslint-plugin-react-dom";
export default tseslint.config({
plugins: {
// Add the react-x and react-dom plugins
"react-x": reactX,
"react-dom": reactDom,
},
rules: {
// other rules...
// Enable its recommended typescript rules
...reactX.configs["recommended-typescript"].rules,
...reactDom.configs.recommended.rules,
},
});
```

28
eslint.config.js Normal file
View File

@ -0,0 +1,28 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
export default tseslint.config(
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
);

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Flowbite React Template Vite</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

5130
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

39
package.json Normal file
View File

@ -0,0 +1,39 @@
{
"name": "flowbite-react-template-vite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"format": "prettier . --write",
"format:check": "prettier . --check"
},
"dependencies": {
"flowbite-react": "^0.12.4",
"react": "^19.1.0",
"react-calendar": "^6.0.0",
"react-dom": "^19.1.1",
"react-router-dom": "^7.8.2",
"vite-tsconfig-paths": "^5.1.4"
},
"devDependencies": {
"@eslint/js": "^9.31.0",
"@tailwindcss/vite": "^4.1.11",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.7.0",
"eslint": "^9.31.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.3.0",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"tailwindcss": "^4.1.11",
"typescript": "~5.8.3",
"typescript-eslint": "^8.38.0",
"vite": "^7.0.5"
}
}

7
prettier.config.js Normal file
View File

@ -0,0 +1,7 @@
/** @type {import('prettier').Config} */
export default {
plugins: ["prettier-plugin-tailwindcss"],
// tailwindcss
tailwindAttributes: ["theme"],
tailwindFunctions: ["twMerge", "createTheme"],
};

14
public/figma.svg Normal file
View File

@ -0,0 +1,14 @@
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1_5911)">
<path d="M18 18C18 16.8065 18.4741 15.6619 19.318 14.818C20.1619 13.9741 21.3065 13.5 22.5 13.5C23.6935 13.5 24.8381 13.9741 25.682 14.818C26.5259 15.6619 27 16.8065 27 18C27 19.1935 26.5259 20.3381 25.682 21.182C24.8381 22.0259 23.6935 22.5 22.5 22.5C21.3065 22.5 20.1619 22.0259 19.318 21.182C18.4741 20.3381 18 19.1935 18 18Z" fill="#1ABCFE"/>
<path d="M9 27C9 25.8065 9.47411 24.6619 10.318 23.818C11.1619 22.9741 12.3065 22.5 13.5 22.5H18V27C18 28.1935 17.5259 29.3381 16.682 30.182C15.8381 31.0259 14.6935 31.5 13.5 31.5C12.3065 31.5 11.1619 31.0259 10.318 30.182C9.47411 29.3381 9 28.1935 9 27V27Z" fill="#0ACF83"/>
<path d="M18 4.5V13.5H22.5C23.6935 13.5 24.8381 13.0259 25.682 12.182C26.5259 11.3381 27 10.1935 27 9C27 7.80653 26.5259 6.66193 25.682 5.81802C24.8381 4.97411 23.6935 4.5 22.5 4.5H18Z" fill="#FF7262"/>
<path d="M9 9C9 10.1935 9.47411 11.3381 10.318 12.182C11.1619 13.0259 12.3065 13.5 13.5 13.5H18V4.5H13.5C12.3065 4.5 11.1619 4.97411 10.318 5.81802C9.47411 6.66193 9 7.80653 9 9V9Z" fill="#F24E1E"/>
<path d="M9 18C9 19.1935 9.47411 20.3381 10.318 21.182C11.1619 22.0259 12.3065 22.5 13.5 22.5H18V13.5H13.5C12.3065 13.5 11.1619 13.9741 10.318 14.818C9.47411 15.6619 9 16.8065 9 18V18Z" fill="#A259FF"/>
</g>
<defs>
<clipPath id="clip0_1_5911">
<rect width="18" height="27" fill="white" transform="translate(9 4.5)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

49
public/flowbite-react.svg Normal file
View File

@ -0,0 +1,49 @@
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M24.5196 13.4429C24.4455 13.9533 24.1089 14.6468 23.7228 15.2497C23.2356 16.0105 22.4625 16.5433 21.5776 16.7283L17.68 17.5434C17.0535 17.6744 16.4855 18.0022 16.0589 18.479L13.5033 21.3357C13.023 21.8725 12.6873 21.7445 12.6873 21.0244C12.6815 21.0511 11.4189 24.3072 14.7649 26.2371C16.0505 26.9787 17.9011 26.7122 19.1867 25.9707L25.9986 22.0416C28.5461 20.5721 30.3448 18.0863 30.9426 15.2089C30.9663 15.095 30.9845 14.9808 31.0042 14.8667L24.5196 13.4429Z" fill="url(#paint0_linear_44_23797)"/>
<path d="M22.7528 9.51774C24.0384 10.2593 24.5637 11.3633 24.5637 12.8464C24.5637 13.0477 24.5479 13.2466 24.5194 13.4425L27.2641 14.6215L31.004 14.8663C31.4829 12.0948 30.5444 9.24202 28.862 6.97445C27.5959 5.268 25.9667 3.78713 24.0081 2.65738C22.417 1.73966 20.7636 1.135 19.1025 0.803223L17.2361 3.22023L16.6465 5.99559L22.7528 9.51774Z" fill="url(#paint1_linear_44_23797)"/>
<path d="M0.783597 11.5518C0.782899 11.554 0.784832 11.5546 0.78556 11.5524C0.929583 11.1205 1.11018 10.6385 1.33564 10.1237C2.51334 7.4343 4.78286 5.64062 7.57492 4.72608C10.367 3.81156 13.4155 4.13212 15.9601 5.59988L16.6465 5.99578L19.1025 0.803412C11.291 -0.756764 3.30728 3.83253 0.793528 11.5217C0.792327 11.5254 0.787957 11.5382 0.783597 11.5518Z" fill="url(#paint2_linear_44_23797)"/>
<path d="M18.9199 25.9704C17.6343 26.712 16.0503 26.712 14.7647 25.9704C14.5902 25.8697 14.4257 25.7566 14.2701 25.634L12.0091 27.1885L10.0603 30.3376C12.2233 32.1377 15.0321 32.7164 17.839 32.3945C19.9513 32.1523 22.0495 31.4832 24.0082 30.3534C25.5992 29.4357 26.95 28.3075 28.0682 27.0361L26.9063 24.2128L25.0262 22.4482L18.9199 25.9704Z" fill="url(#paint3_linear_44_23797)"/>
<path d="M14.2701 25.6341C13.2796 24.8539 12.6871 23.6572 12.6871 22.3754V22.2476V11.5724C12.6871 10.9687 12.865 10.8661 13.3884 11.168C12.5823 10.703 10.7203 9.10701 8.42118 10.4331C7.13557 11.1747 6.0769 12.8116 6.0769 14.2946V22.1529C6.0769 25.0917 7.59906 28.1573 9.79448 30.1133C9.88132 30.1906 9.97122 30.2636 10.0603 30.3377L14.2701 25.6341Z" fill="url(#paint4_linear_44_23797)"/>
<path d="M27.9104 5.8123C27.9089 5.8106 27.9073 5.81197 27.9089 5.81368C28.2113 6.15428 28.5388 6.5515 28.8723 7.00399C30.6148 9.36764 31.2658 12.3613 30.6626 15.2343C30.0593 18.1072 28.2571 20.5846 25.7125 22.0523L25.0261 22.4482L28.0681 27.0361C33.3264 21.0576 33.34 11.8554 27.9315 5.83594C27.9289 5.83306 27.92 5.82287 27.9104 5.8123Z" fill="url(#paint5_linear_44_23797)"/>
<path d="M6.34355 14.2948C6.34354 12.8117 7.13551 11.4413 8.42113 10.6998C8.59564 10.5991 8.77601 10.5133 8.96002 10.44L8.74304 7.70651L7.21861 4.5791C4.57671 5.55054 2.4397 7.55814 1.31528 10.1476C0.469097 12.0962 9.792e-06 14.2463 0 16.5057C0 18.3412 0.302549 20.074 0.845532 21.6772L3.87391 22.0835L6.34355 21.3391V14.2948Z" fill="url(#paint6_linear_44_23797)"/>
<path d="M8.96016 10.44C10.1317 9.97312 11.4653 10.0589 12.5764 10.6998L12.6872 10.7637L21.5826 15.8946C22.2066 16.2545 22.1499 16.6087 21.4446 16.7561L21.9578 16.6488C22.633 16.5077 23.2499 16.1626 23.7217 15.6597C24.5328 14.7951 24.8306 13.752 24.8306 12.8467C24.8306 11.3637 24.0386 9.99323 22.753 9.25169L15.9411 5.32258C13.3936 3.85316 10.3395 3.53983 7.54622 4.46132C7.43572 4.49776 7.32756 4.53909 7.21875 4.5791L8.96016 10.44Z" fill="url(#paint7_linear_44_23797)"/>
<path d="M19.3221 32.1528C19.3244 32.1523 19.3239 32.1503 19.3217 32.1508C18.8752 32.2422 18.3672 32.3269 17.8081 32.3892C14.888 32.715 11.9674 31.7814 9.77864 29.823C7.58986 27.8646 6.34347 25.0667 6.34348 22.1312L6.34347 21.3394L0.845459 21.6774C3.3988 29.2161 11.3689 33.8289 19.2911 32.1593C19.2949 32.1585 19.3082 32.1558 19.3221 32.1528Z" fill="url(#paint8_linear_44_23797)"/>
<defs>
<linearGradient id="paint0_linear_44_23797" x1="20.0602" y1="24.2701" x2="23.2077" y2="13.307" gradientUnits="userSpaceOnUse">
<stop stop-color="#0B7DA0"/>
<stop offset="1" stop-color="#17A3D0"/>
</linearGradient>
<linearGradient id="paint1_linear_44_23797" x1="27.3093" y1="10.9001" x2="19.0297" y2="2.64962" gradientUnits="userSpaceOnUse">
<stop stop-color="#16A2CF"/>
<stop offset="1" stop-color="#17A3D0"/>
</linearGradient>
<linearGradient id="paint2_linear_44_23797" x1="16.1645" y1="5.52115" x2="3.67432" y2="6.3104" gradientUnits="userSpaceOnUse">
<stop stop-color="#17A3D0"/>
<stop offset="1" stop-color="#15A5CC"/>
</linearGradient>
<linearGradient id="paint3_linear_44_23797" x1="15.3198" y1="29.1626" x2="26.5366" y2="26.1358" gradientUnits="userSpaceOnUse">
<stop stop-color="#17A3D0"/>
<stop offset="1" stop-color="#1395BF"/>
</linearGradient>
<linearGradient id="paint4_linear_44_23797" x1="7.26881" y1="16.1827" x2="15.2325" y2="24.4347" gradientUnits="userSpaceOnUse">
<stop stop-color="#0A7C9F"/>
<stop offset="1" stop-color="#17A3D0"/>
</linearGradient>
<linearGradient id="paint5_linear_44_23797" x1="25.4504" y1="22.1356" x2="31.0069" y2="10.9344" gradientUnits="userSpaceOnUse">
<stop stop-color="#1395BF"/>
<stop offset="1" stop-color="#57B6D5"/>
</linearGradient>
<linearGradient id="paint6_linear_44_23797" x1="5.36387" y1="9.63116" x2="2.39054" y2="20.8067" gradientUnits="userSpaceOnUse">
<stop stop-color="#17A3D0"/>
<stop offset="1" stop-color="#1DA4D0"/>
</linearGradient>
<linearGradient id="paint7_linear_44_23797" x1="20.5432" y1="9.09961" x2="9.6778" y2="11.8049" gradientUnits="userSpaceOnUse">
<stop stop-color="#0C7EA0"/>
<stop offset="1" stop-color="#18A3D1"/>
</linearGradient>
<linearGradient id="paint8_linear_44_23797" x1="6.40667" y1="21.8571" x2="13.3324" y2="32.275" gradientUnits="userSpaceOnUse">
<stop stop-color="#17A3D0"/>
<stop offset="1" stop-color="#1395BF" stop-opacity="0.6"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

49
public/flowbite.svg Normal file
View File

@ -0,0 +1,49 @@
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M25.9872 15.1338C25.9177 15.6123 25.6022 16.2625 25.2402 16.8277C24.7834 17.5409 24.0586 18.0405 23.2291 18.2139L19.575 18.978C18.9877 19.1008 18.4551 19.4082 18.0553 19.8552L15.6593 22.5333C15.209 23.0367 14.8943 22.9166 14.8943 22.2416C14.8888 22.2666 13.7052 25.3191 16.8421 27.1285C18.0473 27.8237 19.7823 27.5739 20.9876 26.8787L27.3737 23.1951C29.762 21.8175 31.4483 19.4871 32.0088 16.7894C32.031 16.6827 32.0481 16.5756 32.0666 16.4686L25.9872 15.1338Z" fill="url(#paint0_linear_1_5904)"/>
<path d="M24.3314 11.4545C25.5367 12.1497 26.0291 13.1847 26.0291 14.5751C26.0291 14.7638 26.0143 14.9503 25.9876 15.134L28.5608 16.2393L32.067 16.4688C32.5159 13.8704 31.6361 11.196 30.0588 9.07011C28.8718 7.47031 27.3445 6.08198 25.5082 5.02283C24.0166 4.16246 22.4666 3.59559 20.9092 3.28455L19.1594 5.55051L18.6067 8.15243L24.3314 11.4545Z" fill="url(#paint1_linear_1_5904)"/>
<path d="M3.73476 13.3611C3.7341 13.3632 3.73592 13.3638 3.7366 13.3617C3.87162 12.9568 4.04093 12.5049 4.2523 12.0223C5.35641 9.50095 7.4841 7.81937 10.1017 6.96198C12.7192 6.10461 15.5773 6.40514 17.9629 7.78117L18.6064 8.15233L20.9089 3.28445C13.5855 1.82178 6.10073 6.12427 3.74407 13.3329C3.74294 13.3364 3.73885 13.3484 3.73476 13.3611Z" fill="url(#paint2_linear_1_5904)"/>
<path d="M20.7376 26.8787C19.5323 27.5739 18.0473 27.5739 16.8421 26.8787C16.6785 26.7843 16.5242 26.6782 16.3784 26.5634L14.2586 28.0207L12.4316 30.973C14.4595 32.6606 17.0928 33.2031 19.7242 32.9014C21.7045 32.6743 23.6716 32.047 25.5079 30.9878C26.9995 30.1275 28.2659 29.0698 29.3142 27.8778L28.2249 25.231L26.4623 23.5767L20.7376 26.8787Z" fill="url(#paint3_linear_1_5904)"/>
<path d="M16.3782 26.5632C15.4496 25.8317 14.8942 24.7098 14.8942 23.5082V23.3883V13.3802C14.8942 12.8143 15.0609 12.7181 15.5516 13.0011C14.7959 12.5652 13.0502 11.0689 10.8948 12.3122C9.68953 13.0074 8.69702 14.542 8.69702 15.9324V23.2995C8.69702 26.0547 10.1241 28.9286 12.1823 30.7624C12.2637 30.835 12.348 30.9033 12.4315 30.9728L16.3782 26.5632Z" fill="url(#paint4_linear_1_5904)"/>
<path d="M29.1659 7.98034C29.1645 7.97875 29.1631 7.98003 29.1645 7.98164C29.4481 8.30096 29.7551 8.67335 30.0678 9.09756C31.7013 11.3135 32.3117 14.1201 31.7461 16.8135C31.1805 19.5069 29.491 21.8294 27.1054 23.2055L26.4619 23.5766L29.3138 27.8778C34.2434 22.2729 34.2562 13.6458 29.1857 8.00251C29.1833 7.99981 29.1749 7.99025 29.1659 7.98034Z" fill="url(#paint5_linear_1_5904)"/>
<path d="M8.94712 15.9325C8.94711 14.5421 9.68959 13.2573 10.8949 12.5621C11.0585 12.4678 11.2276 12.3874 11.4001 12.3186L11.1967 9.75594L9.7675 6.82397C7.2907 7.7347 5.28724 9.61685 4.23308 12.0444C3.43978 13.8713 3.00001 15.887 3 18.0053C3 19.726 3.28364 21.3506 3.79269 22.8535L6.63182 23.2345L8.94712 22.5366V15.9325Z" fill="url(#paint6_linear_1_5904)"/>
<path d="M11.4002 12.3187C12.4985 11.881 13.7488 11.9614 14.7904 12.5622L14.8943 12.6221L23.2338 17.4324C23.8188 17.7698 23.7656 18.1018 23.1044 18.2401L23.5855 18.1395C24.2186 18.0071 24.7969 17.6836 25.2392 17.2122C25.9996 16.4016 26.2788 15.4237 26.2788 14.575C26.2788 13.1846 25.5363 11.8998 24.331 11.2046L17.9449 7.52105C15.5566 6.14347 12.6933 5.84972 10.0746 6.71362C9.97099 6.74778 9.86959 6.78653 9.76758 6.82404L11.4002 12.3187Z" fill="url(#paint7_linear_1_5904)"/>
<path d="M21.1147 32.6744C21.1168 32.674 21.1164 32.6721 21.1143 32.6725C20.6957 32.7582 20.2194 32.8376 19.6953 32.8961C16.9577 33.2015 14.2196 32.3263 12.1676 30.4902C10.1156 28.6542 8.94715 26.0311 8.94715 23.2791L8.94714 22.5367L3.79272 22.8536C6.1865 29.9212 13.6585 34.2458 21.0856 32.6805C21.0892 32.6797 21.1016 32.6773 21.1147 32.6744Z" fill="url(#paint8_linear_1_5904)"/>
<defs>
<linearGradient id="paint0_linear_1_5904" x1="21.8065" y1="25.2844" x2="24.7573" y2="15.0064" gradientUnits="userSpaceOnUse">
<stop stop-color="#1724C9"/>
<stop offset="1" stop-color="#1C64F2"/>
</linearGradient>
<linearGradient id="paint1_linear_1_5904" x1="28.6032" y1="12.7505" x2="20.8409" y2="5.01555" gradientUnits="userSpaceOnUse">
<stop stop-color="#1C64F2"/>
<stop offset="1" stop-color="#0092FF"/>
</linearGradient>
<linearGradient id="paint2_linear_1_5904" x1="18.1544" y1="7.70736" x2="6.44483" y2="8.44729" gradientUnits="userSpaceOnUse">
<stop stop-color="#0092FF"/>
<stop offset="1" stop-color="#45B2FF"/>
</linearGradient>
<linearGradient id="paint3_linear_1_5904" x1="17.3625" y1="29.8714" x2="27.8783" y2="27.0338" gradientUnits="userSpaceOnUse">
<stop stop-color="#1C64F2"/>
<stop offset="1" stop-color="#0092FF"/>
</linearGradient>
<linearGradient id="paint4_linear_1_5904" x1="9.81444" y1="17.7024" x2="17.2804" y2="25.4388" gradientUnits="userSpaceOnUse">
<stop stop-color="#1724C9"/>
<stop offset="1" stop-color="#1C64F2"/>
</linearGradient>
<linearGradient id="paint5_linear_1_5904" x1="26.8597" y1="23.2835" x2="32.0689" y2="12.7824" gradientUnits="userSpaceOnUse">
<stop stop-color="#0092FF"/>
<stop offset="1" stop-color="#45B2FF"/>
</linearGradient>
<linearGradient id="paint6_linear_1_5904" x1="8.02866" y1="11.5603" x2="5.24114" y2="22.0375" gradientUnits="userSpaceOnUse">
<stop stop-color="#1C64F2"/>
<stop offset="1" stop-color="#0092FF"/>
</linearGradient>
<linearGradient id="paint7_linear_1_5904" x1="22.2593" y1="11.062" x2="12.073" y2="13.5982" gradientUnits="userSpaceOnUse">
<stop stop-color="#1724C9"/>
<stop offset="1" stop-color="#1C64F2"/>
</linearGradient>
<linearGradient id="paint8_linear_1_5904" x1="9.0064" y1="23.0221" x2="15.4994" y2="32.789" gradientUnits="userSpaceOnUse">
<stop stop-color="#0092FF"/>
<stop offset="1" stop-color="#45B2FF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

10
public/pattern-dark.svg Normal file
View File

@ -0,0 +1,10 @@
<svg width="803" height="775" viewBox="0 0 803 775" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M727.909 -122.953L664.929 -221.405L570.148 -154.572M727.909 -122.953L633.128 -56.1205M727.909 -122.953L790.888 -24.5014M633.128 -56.1205L570.148 -154.572M633.128 -56.1205L696.108 42.3312M633.128 -56.1205L538.348 10.7121M570.148 -154.572L475.368 -87.7397M790.888 -24.5014L696.108 42.3312M790.888 -24.5014L853.868 73.9504M696.108 42.3312L759.088 140.783M696.108 42.3312L601.328 109.164M853.868 73.9504L759.088 140.783M853.868 73.9504L916.848 172.402M759.088 140.783L822.068 239.235M759.088 140.783L664.308 207.616M916.848 172.402L822.068 239.235M916.848 172.402L979.828 270.854M822.068 239.235L885.048 337.686M822.068 239.235L727.288 306.067M979.828 270.854L885.048 337.686M979.828 270.854L1042.81 369.306M885.048 337.686L948.028 436.138M885.048 337.686L790.267 404.519M1042.81 369.306L948.028 436.138M1042.81 369.306L1105.79 467.757L1011.01 534.59M948.028 436.138L1011.01 534.59M948.028 436.138L853.247 502.971M1011.01 534.59L916.227 601.422M538.348 10.7121L475.368 -87.7397M538.348 10.7121L601.328 109.164M538.348 10.7121L443.568 77.5446M475.368 -87.7397L380.588 -20.9071M601.328 109.164L664.308 207.616M601.328 109.164L506.547 175.996M664.308 207.616L727.288 306.067M664.308 207.616L569.527 274.448M727.288 306.067L790.267 404.519M727.288 306.067L632.507 372.9M790.267 404.519L853.247 502.971M790.267 404.519L695.487 471.352M853.247 502.971L916.227 601.422M853.247 502.971L758.467 569.803M916.227 601.422L821.447 668.255M443.568 77.5446L380.588 -20.9071M443.568 77.5446L506.547 175.996M443.568 77.5446L348.787 144.377M380.588 -20.9071L285.807 45.9255M506.547 175.996L569.527 274.448M506.547 175.996L411.767 242.829M569.527 274.448L632.507 372.9M569.527 274.448L474.747 341.281M632.507 372.9L695.487 471.352M632.507 372.9L537.727 439.732M695.487 471.352L758.467 569.803M695.487 471.352L600.707 538.184M758.467 569.803L821.447 668.255M758.467 569.803L663.687 636.636M821.447 668.255L726.667 735.088M348.787 144.377L285.807 45.9255M348.787 144.377L411.767 242.829M348.787 144.377L254.007 211.21M285.807 45.9255L191.027 112.758M411.767 242.829L474.747 341.281M411.767 242.829L316.987 309.662M474.747 341.281L537.727 439.732M474.747 341.281L379.967 408.113M537.727 439.732L600.707 538.184M537.727 439.732L442.947 506.565M600.707 538.184L663.687 636.636M600.707 538.184L505.927 605.017M663.687 636.636L726.667 735.088M663.687 636.636L568.906 703.468M726.667 735.088L631.886 801.92M254.007 211.21L191.027 112.758M254.007 211.21L316.987 309.662M254.007 211.21L159.227 278.042M191.027 112.758L96.2467 179.591M316.987 309.662L379.967 408.113M316.987 309.662L222.207 376.494M379.967 408.113L442.947 506.565M379.967 408.113L285.186 474.946M442.947 506.565L505.927 605.017M442.947 506.565L348.166 573.398M505.927 605.017L568.906 703.468M505.927 605.017L411.146 671.849M568.906 703.468L631.886 801.92M568.906 703.468L474.126 770.301M631.886 801.92L537.106 868.753M159.227 278.042L96.2467 179.591M159.227 278.042L222.207 376.494M159.227 278.042L64.4463 344.875M96.2467 179.591L1.46641 246.423L64.4463 344.875M222.207 376.494L285.186 474.946M222.207 376.494L127.426 443.327M285.186 474.946L348.166 573.398M285.186 474.946L190.406 541.778M348.166 573.398L411.146 671.849M348.166 573.398L253.386 640.23M411.146 671.849L474.126 770.301M411.146 671.849L316.366 738.682M474.126 770.301L537.106 868.753M474.126 770.301L379.346 837.134M537.106 868.753L442.326 935.585L379.346 837.134M64.4463 344.875L127.426 443.327M127.426 443.327L190.406 541.778M190.406 541.778L253.386 640.23M253.386 640.23L316.366 738.682M316.366 738.682L379.346 837.134" stroke="#1E2939"/>
<path d="M727.909 -122.953L664.929 -221.405L570.148 -154.572M727.909 -122.953L633.128 -56.1205M727.909 -122.953L790.888 -24.5014M633.128 -56.1205L570.148 -154.572M633.128 -56.1205L696.108 42.3312M633.128 -56.1205L538.348 10.7121M570.148 -154.572L475.368 -87.7397M790.888 -24.5014L696.108 42.3312M790.888 -24.5014L853.868 73.9504M696.108 42.3312L759.088 140.783M696.108 42.3312L601.328 109.164M853.868 73.9504L759.088 140.783M853.868 73.9504L916.848 172.402M759.088 140.783L822.068 239.235M759.088 140.783L664.308 207.616M916.848 172.402L822.068 239.235M916.848 172.402L979.828 270.854M822.068 239.235L885.048 337.686M822.068 239.235L727.288 306.067M979.828 270.854L885.048 337.686M979.828 270.854L1042.81 369.306M885.048 337.686L948.028 436.138M885.048 337.686L790.267 404.519M1042.81 369.306L948.028 436.138M1042.81 369.306L1105.79 467.757L1011.01 534.59M948.028 436.138L1011.01 534.59M948.028 436.138L853.247 502.971M1011.01 534.59L916.227 601.422M538.348 10.7121L475.368 -87.7397M538.348 10.7121L601.328 109.164M538.348 10.7121L443.568 77.5446M475.368 -87.7397L380.588 -20.9071M601.328 109.164L664.308 207.616M601.328 109.164L506.547 175.996M664.308 207.616L727.288 306.067M664.308 207.616L569.527 274.448M727.288 306.067L790.267 404.519M727.288 306.067L632.507 372.9M790.267 404.519L853.247 502.971M790.267 404.519L695.487 471.352M853.247 502.971L916.227 601.422M853.247 502.971L758.467 569.803M916.227 601.422L821.447 668.255M443.568 77.5446L380.588 -20.9071M443.568 77.5446L506.547 175.996M443.568 77.5446L348.787 144.377M380.588 -20.9071L285.807 45.9255M506.547 175.996L569.527 274.448M506.547 175.996L411.767 242.829M569.527 274.448L632.507 372.9M569.527 274.448L474.747 341.281M632.507 372.9L695.487 471.352M632.507 372.9L537.727 439.732M695.487 471.352L758.467 569.803M695.487 471.352L600.707 538.184M758.467 569.803L821.447 668.255M758.467 569.803L663.687 636.636M821.447 668.255L726.667 735.088M348.787 144.377L285.807 45.9255M348.787 144.377L411.767 242.829M348.787 144.377L254.007 211.21M285.807 45.9255L191.027 112.758M411.767 242.829L474.747 341.281M411.767 242.829L316.987 309.662M474.747 341.281L537.727 439.732M474.747 341.281L379.967 408.113M537.727 439.732L600.707 538.184M537.727 439.732L442.947 506.565M600.707 538.184L663.687 636.636M600.707 538.184L505.927 605.017M663.687 636.636L726.667 735.088M663.687 636.636L568.906 703.468M726.667 735.088L631.886 801.92M254.007 211.21L191.027 112.758M254.007 211.21L316.987 309.662M254.007 211.21L159.227 278.042M191.027 112.758L96.2467 179.591M316.987 309.662L379.967 408.113M316.987 309.662L222.207 376.494M379.967 408.113L442.947 506.565M379.967 408.113L285.186 474.946M442.947 506.565L505.927 605.017M442.947 506.565L348.166 573.398M505.927 605.017L568.906 703.468M505.927 605.017L411.146 671.849M568.906 703.468L631.886 801.92M568.906 703.468L474.126 770.301M631.886 801.92L537.106 868.753M159.227 278.042L96.2467 179.591M159.227 278.042L222.207 376.494M159.227 278.042L64.4463 344.875M96.2467 179.591L1.46641 246.423L64.4463 344.875M222.207 376.494L285.186 474.946M222.207 376.494L127.426 443.327M285.186 474.946L348.166 573.398M285.186 474.946L190.406 541.778M348.166 573.398L411.146 671.849M348.166 573.398L253.386 640.23M411.146 671.849L474.126 770.301M411.146 671.849L316.366 738.682M474.126 770.301L537.106 868.753M474.126 770.301L379.346 837.134M537.106 868.753L442.326 935.585L379.346 837.134M64.4463 344.875L127.426 443.327M127.426 443.327L190.406 541.778M190.406 541.778L253.386 640.23M253.386 640.23L316.366 738.682M316.366 738.682L379.346 837.134" stroke="url(#paint0_linear_16600_43)" stroke-opacity="0.7"/>
<defs>
<linearGradient id="paint0_linear_16600_43" x1="188.555" y1="516.117" x2="761.303" y2="116.076" gradientUnits="userSpaceOnUse">
<stop offset="0.377045" stop-color="#0C1220"/>
<stop offset="1" stop-color="#1E2939"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

10
public/pattern-light.svg Normal file
View File

@ -0,0 +1,10 @@
<svg width="803" height="774" viewBox="0 0 803 774" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M727.909 -123.953L664.929 -222.405L570.148 -155.572M727.909 -123.953L633.128 -57.1205M727.909 -123.953L790.888 -25.5014M633.128 -57.1205L570.148 -155.572M633.128 -57.1205L696.108 41.3312M633.128 -57.1205L538.348 9.71206M570.148 -155.572L475.368 -88.7397M790.888 -25.5014L696.108 41.3312M790.888 -25.5014L853.868 72.9504M696.108 41.3312L759.088 139.783M696.108 41.3312L601.328 108.164M853.868 72.9504L759.088 139.783M853.868 72.9504L916.848 171.402M759.088 139.783L822.068 238.235M759.088 139.783L664.308 206.616M916.848 171.402L822.068 238.235M916.848 171.402L979.828 269.854M822.068 238.235L885.048 336.686M822.068 238.235L727.288 305.067M979.828 269.854L885.048 336.686M979.828 269.854L1042.81 368.306M885.048 336.686L948.028 435.138M885.048 336.686L790.267 403.519M1042.81 368.306L948.028 435.138M1042.81 368.306L1105.79 466.757L1011.01 533.59M948.028 435.138L1011.01 533.59M948.028 435.138L853.247 501.971M1011.01 533.59L916.227 600.422M538.348 9.71206L475.368 -88.7397M538.348 9.71206L601.328 108.164M538.348 9.71206L443.568 76.5446M475.368 -88.7397L380.588 -21.9071M601.328 108.164L664.308 206.616M601.328 108.164L506.547 174.996M664.308 206.616L727.288 305.067M664.308 206.616L569.527 273.448M727.288 305.067L790.267 403.519M727.288 305.067L632.507 371.9M790.267 403.519L853.247 501.971M790.267 403.519L695.487 470.352M853.247 501.971L916.227 600.422M853.247 501.971L758.467 568.803M916.227 600.422L821.447 667.255M443.568 76.5446L380.588 -21.9071M443.568 76.5446L506.547 174.996M443.568 76.5446L348.787 143.377M380.588 -21.9071L285.807 44.9255M506.547 174.996L569.527 273.448M506.547 174.996L411.767 241.829M569.527 273.448L632.507 371.9M569.527 273.448L474.747 340.281M632.507 371.9L695.487 470.352M632.507 371.9L537.727 438.732M695.487 470.352L758.467 568.803M695.487 470.352L600.707 537.184M758.467 568.803L821.447 667.255M758.467 568.803L663.687 635.636M821.447 667.255L726.667 734.088M348.787 143.377L285.807 44.9255M348.787 143.377L411.767 241.829M348.787 143.377L254.007 210.21M285.807 44.9255L191.027 111.758M411.767 241.829L474.747 340.281M411.767 241.829L316.987 308.662M474.747 340.281L537.727 438.732M474.747 340.281L379.967 407.113M537.727 438.732L600.707 537.184M537.727 438.732L442.947 505.565M600.707 537.184L663.687 635.636M600.707 537.184L505.927 604.017M663.687 635.636L726.667 734.088M663.687 635.636L568.906 702.468M726.667 734.088L631.886 800.92M254.007 210.21L191.027 111.758M254.007 210.21L316.987 308.662M254.007 210.21L159.227 277.042M191.027 111.758L96.2467 178.591M316.987 308.662L379.967 407.113M316.987 308.662L222.207 375.494M379.967 407.113L442.947 505.565M379.967 407.113L285.186 473.946M442.947 505.565L505.927 604.017M442.947 505.565L348.166 572.398M505.927 604.017L568.906 702.468M505.927 604.017L411.146 670.849M568.906 702.468L631.886 800.92M568.906 702.468L474.126 769.301M631.886 800.92L537.106 867.753M159.227 277.042L96.2467 178.591M159.227 277.042L222.207 375.494M159.227 277.042L64.4463 343.875M96.2467 178.591L1.46641 245.423L64.4463 343.875M222.207 375.494L285.186 473.946M222.207 375.494L127.426 442.327M285.186 473.946L348.166 572.398M285.186 473.946L190.406 540.778M348.166 572.398L411.146 670.849M348.166 572.398L253.386 639.23M411.146 670.849L474.126 769.301M411.146 670.849L316.366 737.682M474.126 769.301L537.106 867.753M474.126 769.301L379.346 836.134M537.106 867.753L442.326 934.585L379.346 836.134M64.4463 343.875L127.426 442.327M127.426 442.327L190.406 540.778M190.406 540.778L253.386 639.23M253.386 639.23L316.366 737.682M316.366 737.682L379.346 836.134" stroke="#F3F4F6"/>
<path d="M727.909 -123.953L664.929 -222.405L570.148 -155.572M727.909 -123.953L633.128 -57.1205M727.909 -123.953L790.888 -25.5014M633.128 -57.1205L570.148 -155.572M633.128 -57.1205L696.108 41.3312M633.128 -57.1205L538.348 9.71206M570.148 -155.572L475.368 -88.7397M790.888 -25.5014L696.108 41.3312M790.888 -25.5014L853.868 72.9504M696.108 41.3312L759.088 139.783M696.108 41.3312L601.328 108.164M853.868 72.9504L759.088 139.783M853.868 72.9504L916.848 171.402M759.088 139.783L822.068 238.235M759.088 139.783L664.308 206.616M916.848 171.402L822.068 238.235M916.848 171.402L979.828 269.854M822.068 238.235L885.048 336.686M822.068 238.235L727.288 305.067M979.828 269.854L885.048 336.686M979.828 269.854L1042.81 368.306M885.048 336.686L948.028 435.138M885.048 336.686L790.267 403.519M1042.81 368.306L948.028 435.138M1042.81 368.306L1105.79 466.757L1011.01 533.59M948.028 435.138L1011.01 533.59M948.028 435.138L853.247 501.971M1011.01 533.59L916.227 600.422M538.348 9.71206L475.368 -88.7397M538.348 9.71206L601.328 108.164M538.348 9.71206L443.568 76.5446M475.368 -88.7397L380.588 -21.9071M601.328 108.164L664.308 206.616M601.328 108.164L506.547 174.996M664.308 206.616L727.288 305.067M664.308 206.616L569.527 273.448M727.288 305.067L790.267 403.519M727.288 305.067L632.507 371.9M790.267 403.519L853.247 501.971M790.267 403.519L695.487 470.352M853.247 501.971L916.227 600.422M853.247 501.971L758.467 568.803M916.227 600.422L821.447 667.255M443.568 76.5446L380.588 -21.9071M443.568 76.5446L506.547 174.996M443.568 76.5446L348.787 143.377M380.588 -21.9071L285.807 44.9255M506.547 174.996L569.527 273.448M506.547 174.996L411.767 241.829M569.527 273.448L632.507 371.9M569.527 273.448L474.747 340.281M632.507 371.9L695.487 470.352M632.507 371.9L537.727 438.732M695.487 470.352L758.467 568.803M695.487 470.352L600.707 537.184M758.467 568.803L821.447 667.255M758.467 568.803L663.687 635.636M821.447 667.255L726.667 734.088M348.787 143.377L285.807 44.9255M348.787 143.377L411.767 241.829M348.787 143.377L254.007 210.21M285.807 44.9255L191.027 111.758M411.767 241.829L474.747 340.281M411.767 241.829L316.987 308.662M474.747 340.281L537.727 438.732M474.747 340.281L379.967 407.113M537.727 438.732L600.707 537.184M537.727 438.732L442.947 505.565M600.707 537.184L663.687 635.636M600.707 537.184L505.927 604.017M663.687 635.636L726.667 734.088M663.687 635.636L568.906 702.468M726.667 734.088L631.886 800.92M254.007 210.21L191.027 111.758M254.007 210.21L316.987 308.662M254.007 210.21L159.227 277.042M191.027 111.758L96.2467 178.591M316.987 308.662L379.967 407.113M316.987 308.662L222.207 375.494M379.967 407.113L442.947 505.565M379.967 407.113L285.186 473.946M442.947 505.565L505.927 604.017M442.947 505.565L348.166 572.398M505.927 604.017L568.906 702.468M505.927 604.017L411.146 670.849M568.906 702.468L631.886 800.92M568.906 702.468L474.126 769.301M631.886 800.92L537.106 867.753M159.227 277.042L96.2467 178.591M159.227 277.042L222.207 375.494M159.227 277.042L64.4463 343.875M96.2467 178.591L1.46641 245.423L64.4463 343.875M222.207 375.494L285.186 473.946M222.207 375.494L127.426 442.327M285.186 473.946L348.166 572.398M285.186 473.946L190.406 540.778M348.166 572.398L411.146 670.849M348.166 572.398L253.386 639.23M411.146 670.849L474.126 769.301M411.146 670.849L316.366 737.682M474.126 769.301L537.106 867.753M474.126 769.301L379.346 836.134M537.106 867.753L442.326 934.585L379.346 836.134M64.4463 343.875L127.426 442.327M127.426 442.327L190.406 540.778M190.406 540.778L253.386 639.23M253.386 639.23L316.366 737.682M316.366 737.682L379.346 836.134" stroke="url(#paint0_linear_1_5021)" stroke-opacity="0.7"/>
<defs>
<linearGradient id="paint0_linear_1_5021" x1="188.555" y1="515.117" x2="761.303" y2="115.076" gradientUnits="userSpaceOnUse">
<stop offset="0.377045" stop-color="white"/>
<stop offset="1" stop-color="#E5E7EB"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

10
src/App.tsx Normal file
View File

@ -0,0 +1,10 @@
import { Route, Routes } from "react-router-dom";
import IndexPage from "./pages";
export default function App() {
return (
<Routes>
<Route element={<IndexPage />} path="/" />
</Routes>
);
}

18
src/classes/DateRange.ts Normal file
View File

@ -0,0 +1,18 @@
export default class DateRange {
constructor(
public startDate: string,
public endDate: string
) {}
generateDatesBetween(): Date[] {
const arr: Date[] = [];
const startDate = new Date(this.startDate);
const endDate = new Date(this.endDate);
const currentDate = new Date(startDate);
while (currentDate <= endDate) {
arr.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}
return arr;
}
}

105
src/components/calendar.tsx Normal file
View File

@ -0,0 +1,105 @@
import DateRange from "@/classes/DateRange";
import "@/styles/calendar.css";
import "react-calendar/dist/Calendar.css";
import Calendar from "react-calendar";
import { Value } from "@/types/CalendarDates.ts";
export default function CustomCalendar(props: {
enemyDates: DateRange[];
allyDates: DateRange[];
selfDates: DateRange[];
calendarValue: Value,
onChangeCalendarValue: (newValue:Value) => void,
}){
type CalDate = {
activeStartDate: Date;
date: Date;
view: string;
};
const calendarValue = props.calendarValue;
const zerofyDate = (month: number): string => {
return month < 10 ? "0" + month : month.toString();
};
const formatDate = (date: Date): string => {
return (
date.getFullYear() +
"-" +
zerofyDate(date.getMonth() + 1) +
"-" +
zerofyDate(date.getDate())
);
};
function listDatesFromRangeList(dateRangeArr: DateRange[]): Date[] {
const dates: Date[] = [];
for (const dateRange of dateRangeArr) {
const list: Date[] = dateRange.generateDatesBetween();
list.forEach(date => {
if (!dates.includes(date)) {
dates.push(date);
}
});
}
return dates;
}
const enemyDates = listDatesFromRangeList(props.enemyDates);
const allyDates = listDatesFromRangeList(props.allyDates);
const selfDates = listDatesFromRangeList(props.selfDates);
const calculateDateClass = (date: CalDate): string => {
if (date.view === "month") {
const defaultCellClass = "cell ";
const wrappingDate = formatDate(new Date(date.date));
const isEnemy = enemyDates.some(
(enemyDate: Date) => formatDate(enemyDate) == wrappingDate,
);
const isAlly = allyDates.some(
(allyDate: Date) => formatDate(allyDate) == wrappingDate,
);
const isSelf = selfDates.some(
(selfDate: Date) => formatDate(selfDate) == wrappingDate,
);
// enemy > self > ally | default
if (isSelf && isAlly && isEnemy) {
return defaultCellClass + "ally-self-enemy";
} else if (isSelf && isAlly && !isEnemy) {
return defaultCellClass + "ally-self";
} else if (isSelf && !isAlly && isEnemy) {
return defaultCellClass + "enemy-self";
} else if (!isSelf && isAlly && isEnemy) {
return defaultCellClass + "ally-enemy";
} else if (isEnemy) {
return defaultCellClass + "enemy";
} else if (isSelf) {
return defaultCellClass + "self";
} else if (isAlly) {
return defaultCellClass + "ally";
}
return defaultCellClass + "default";
}
return "";
};
return (
<>
<Calendar
className="calendar default"
locale="ru-RU"
selectRange={true}
tileClassName={calculateDateClass}
returnValue="range"
value={calendarValue}
onChange={props.onChangeCalendarValue}
/>
</>
);
}

57
src/components/navbar.tsx Normal file
View File

@ -0,0 +1,57 @@
import { useState } from "react";
import {
Navbar,
NavbarBrand,
NavbarCollapse,
NavbarLink,
NavbarToggle,
} from "flowbite-react";
export default function NavBar(){
const [isAuthenticated, setIsAuthenticated] = useState(false);
const user = {
name: "Dhaverd",
};
function ToggleNavbar() {
setIsAuthenticated(!isAuthenticated);
}
function AuthNavbar(){
if (isAuthenticated) {
return (
<>
<NavbarLink href="#">{user.name}</NavbarLink>
<NavbarLink href="#" onClick={ToggleNavbar}>
Logout
</NavbarLink>
</>
);
} else {
return (
<>
<NavbarLink href="#" onClick={ToggleNavbar}>
Login
</NavbarLink>
<NavbarLink href="#">Registration</NavbarLink>
</>
);
}
}
return (
<>
<Navbar fluid rounded className="w-full">
<NavbarBrand />
<NavbarToggle />
<NavbarCollapse className="w-full">
<NavbarLink active href="#">
Home
</NavbarLink>
<AuthNavbar />
</NavbarCollapse>
</Navbar>
</>
)
}

7
src/index.css Normal file
View File

@ -0,0 +1,7 @@
@import "tailwindcss";
@plugin "flowbite-react/plugin/tailwindcss";
@source "../.flowbite-react/class-list.json";
@config "../tailwind.config.js";
@custom-variant dark (&:where(.dark, .dark *));

14
src/layouts/default.tsx Normal file
View File

@ -0,0 +1,14 @@
import React from "react";
import NavBar from "../components/navbar.tsx";
import { Card } from "flowbite-react";
export default function DefaultLayout({ children }: {children: React.ReactNode;}) {
return (
<>
<NavBar/>
<Card className="w-full">
{ children }
</Card>
</>
)
}

19
src/main.tsx Normal file
View File

@ -0,0 +1,19 @@
import { initThemeMode } from "flowbite-react";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { ThemeInit } from "../.flowbite-react/init";
import App from "./App.tsx";
import "./index.css";
import { BrowserRouter } from "react-router-dom";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<ThemeInit />
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>,
);
initThemeMode();

80
src/pages/index.tsx Normal file
View File

@ -0,0 +1,80 @@
import DefaultLayout from "../layouts/default.tsx";
import DateRange from "@/classes/DateRange";
import CustomCalendar from "../components/calendar.tsx";
import "@/styles/index-page.css"
import { Button } from "flowbite-react";
import { useState } from "react";
import { Value } from "@/types/CalendarDates.ts";
export default function IndexPage() {
const [calendarValue, setCalendarValue] = useState<Value>([new Date(), new Date()]);
function clearCalendarValue() {
setCalendarValue([null, null]);
}
function onChangeCalendarValue(newValue:Value) {
setCalendarValue(newValue);
}
const allyDates: DateRange[] = [
new DateRange("2025-08-14", "2025-08-17")
];
const renderListAllyDates = allyDates.map((date) => (
<li key={crypto.randomUUID()}>
{date.startDate} - {date.endDate}
</li>
));
const selfDates = [new DateRange("2025-08-12", "2025-08-15")];
const renderListSelfDates = selfDates.map((date) => (
<li key={crypto.randomUUID()}>
{date.startDate} - {date.endDate}
</li>
));
const enemyDates = [new DateRange("2025-08-18", "2025-08-21"), new DateRange("2025-08-08", "2025-08-14")];
const renderListEnemyDates = enemyDates.map((date) => (
<li key={crypto.randomUUID()}>
{date.startDate} - {date.endDate}
</li>
));
return (
<>
<DefaultLayout>
<div className="main-container">
<div className="sub-container">
<CustomCalendar
allyDates={allyDates}
enemyDates={enemyDates}
selfDates={selfDates}
calendarValue={calendarValue}
onChangeCalendarValue={onChangeCalendarValue}
/>
<Button className="m-3" onClick={clearCalendarValue}>Clear</Button>
</div>
<div className="sub-container">
<div className="date-list">
<p className="text-blue-700">Your vacation dates</p>
<ul>{renderListSelfDates}</ul>
</div>
<div className="date-list">
<p className="text-green-800">Must intersect</p>
<ul>{renderListAllyDates}</ul>
</div>
<div className="date-list">
<p className="text-amber-600">Must not intersect</p>
<ul>{renderListEnemyDates}</ul>
</div>
</div>
</div>
</DefaultLayout>
</>
);
}

47
src/styles/calendar.css Normal file
View File

@ -0,0 +1,47 @@
.enemy {
/*color: orange;*/
background-color: orange!important;
}
.ally {
background-color: green!important;
}
.self {
background-color: #0053ff !important;
color: white!important;
}
.ally-self {
background: #008000FF!important;
background: linear-gradient(45deg,rgba(0, 128, 0, 1) 40%, rgba(0, 83, 255, 1) 60%)!important;
}
.enemy-self {
background: #FFA500FF!important;
background: linear-gradient(45deg,rgba(255, 165, 0, 1) 40%, rgba(0, 83, 255, 1) 60%)!important;
}
.ally-enemy {
background: #FFA500FF;
background: linear-gradient(45deg,rgba(255, 165, 0, 1) 40%, rgba(0, 128, 0, 1) 60%)!important;
}
.ally-self-enemy {
background: #FFA500FF;
background: linear-gradient(45deg,rgba(255, 165, 0, 1) 30%, rgba(0, 83, 255, 1) 50%, rgba(0, 128, 0, 1) 70%)!important;
}
.default {
background-color: white;
}
.cell {
border-radius: 7px;
/*border: black solid 1px!important;*/
}
.calendar {
color: black;
border-radius: 10px;
}

25
src/styles/index-page.css Normal file
View File

@ -0,0 +1,25 @@
.main-container {
display: flex;
/*background-color: red;*/
padding: 10px;
}
.sub-container {
display: flex;
flex-direction: column;
/*background-color: blue;*/
width: 50%;
color: white;
text-align: center;
align-items: center;
}
.sub-container > ul {
border: 2px solid black;
width: 100%;
}
.date-list {
height: 33%;
align-content: center;
}

View File

@ -0,0 +1,3 @@
export type ValuePiece = Date | null;
export type Value = ValuePiece | [ValuePiece, ValuePiece];

1
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

14
tailwind.config.js Normal file
View File

@ -0,0 +1,14 @@
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
'./src/layouts/**/*.{js,ts,jsx,tsx,mdx}',
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [],
}

30
tsconfig.app.json Normal file
View File

@ -0,0 +1,30 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"paths": {
"@/*": ["./src/*"]
},
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

12
tsconfig.json Normal file
View File

@ -0,0 +1,12 @@
{
"files": [],
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
},
},
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

28
tsconfig.node.json Normal file
View File

@ -0,0 +1,28 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
"paths": {
"@/*": ["./src/*"]
},
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

1
tsconfig.tsbuildinfo Normal file
View File

@ -0,0 +1 @@
{"root":["./src/App.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/classes/DateRange.ts","./src/components/calendar.tsx","./src/components/navbar.tsx","./src/layouts/default.tsx","./src/pages/index.tsx"],"errors":true,"version":"5.8.3"}

10
vite.config.ts Normal file
View File

@ -0,0 +1,10 @@
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import flowbiteReact from "flowbite-react/plugin/vite";
import tsconfigPaths from "vite-tsconfig-paths";
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tsconfigPaths(), tailwindcss(), flowbiteReact()],
});