Skip to content

Commit

Permalink
Improvement and fix bug known
Browse files Browse the repository at this point in the history
  • Loading branch information
Faelayis committed Feb 26, 2024
1 parent ebb0a29 commit aaea311
Show file tree
Hide file tree
Showing 34 changed files with 776 additions and 651 deletions.
59 changes: 49 additions & 10 deletions Client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@cmru-e-sport/client",
"version": "1.0.7",
"version": "1.2.0",
"scripts": {
"build": "next build",
"clean": "del-cli .next",
Expand Down Expand Up @@ -39,7 +39,9 @@
"@types/react-dom": "18.2.19",
"autoprefixer": "10.4.17",
"eslint-config-next": "14.1.0",
"eslint-plugin-perfectionist": "2.5.0",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-tailwindcss": "3.14.3",
"postcss": "8.4.35",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand All @@ -48,25 +50,62 @@
"eslintConfig": {
"root": true,
"extends": [
"eslint:recommended",
"prettier",
"next"
"next/core-web-vitals",
"plugin:@next/next/recommended",
"plugin:react/recommended",
"plugin:tailwindcss/recommended",
"prettier"
],
"overrides": [
{
"files": [
"*.js",
"*.jsx"
],
"parser": "@typescript-eslint/parser"
},
{
"files": [
"./src/**/**"
],
"plugins": [
"perfectionist"
],
"extends": [
"plugin:perfectionist/recommended-natural"
],
"rules": {
"perfectionist/sort-named-imports": "warn",
"perfectionist/sort-imports": "warn",
"perfectionist/sort-objects": "warn"
}
}
],
"plugins": [
"react",
"tailwindcss",
"prettier"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"ignorePatterns": [
"node_modules",
"src/pages/api"
],
"env": {
"browser": true,
"node": true,
"es6": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"no-unused-vars": "warn"
"tailwindcss/no-custom-classname": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"no-unused-vars": "warn",
"no-undef": "off"
}
},
"prettier": {
Expand Down
16 changes: 8 additions & 8 deletions Client/src/components/icons.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";

export const Logo = ({ size = 36, width, height, ...props }) => (
export const Logo = ({ height, size = 36, width, ...props }) => (
<svg
fill="none"
height={size || height}
Expand All @@ -17,7 +17,7 @@ export const Logo = ({ size = 36, width, height, ...props }) => (
</svg>
);

export const DiscordIcon = ({ size = 24, width, height, ...props }) => {
export const DiscordIcon = ({ height, size = 24, width, ...props }) => {
return (
<svg
height={size || height}
Expand All @@ -33,7 +33,7 @@ export const DiscordIcon = ({ size = 24, width, height, ...props }) => {
);
};

export const TwitterIcon = ({ size = 24, width, height, ...props }) => {
export const TwitterIcon = ({ height, size = 24, width, ...props }) => {
return (
<svg
height={size || height}
Expand All @@ -49,7 +49,7 @@ export const TwitterIcon = ({ size = 24, width, height, ...props }) => {
);
};

export const GithubIcon = ({ size = 24, width, height, ...props }) => {
export const GithubIcon = ({ height, size = 24, width, ...props }) => {
return (
<svg
height={size || height}
Expand All @@ -67,7 +67,7 @@ export const GithubIcon = ({ size = 24, width, height, ...props }) => {
);
};

export const MoonFilledIcon = ({ size = 24, width, height, ...props }) => (
export const MoonFilledIcon = ({ height, size = 24, width, ...props }) => (
<svg
aria-hidden="true"
focusable="false"
Expand All @@ -84,7 +84,7 @@ export const MoonFilledIcon = ({ size = 24, width, height, ...props }) => (
</svg>
);

export const SunFilledIcon = ({ size = 24, width, height, ...props }) => (
export const SunFilledIcon = ({ height, size = 24, width, ...props }) => (
<svg
aria-hidden="true"
focusable="false"
Expand All @@ -101,7 +101,7 @@ export const SunFilledIcon = ({ size = 24, width, height, ...props }) => (
</svg>
);

export const HeartFilledIcon = ({ size = 24, width, height, ...props }) => (
export const HeartFilledIcon = ({ height, size = 24, width, ...props }) => (
<svg
aria-hidden="true"
focusable="false"
Expand Down Expand Up @@ -150,7 +150,7 @@ export const SearchIcon = (props) => (
);

export const NextUILogo = (props) => {
const { width, height = 40 } = props;
const { height = 40, width } = props;

return (
<svg
Expand Down
41 changes: 16 additions & 25 deletions Client/src/components/navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { ThemeSwitch } from "@/components/theme-switch";
import { siteConfig } from "@/config/site";
import { Link } from "@nextui-org/link";
import {
Navbar as NextUINavbar,
NavbarContent,
NavbarMenu,
NavbarMenuToggle,
NavbarBrand,
NavbarContent,
NavbarItem,
NavbarMenu,
NavbarMenuItem,
NavbarMenuToggle,
Navbar as NextUINavbar,
} from "@nextui-org/navbar";
import { Link } from "@nextui-org/link";
import { link as linkStyles } from "@nextui-org/theme";
import { siteConfig } from "@/config/site";
import NextLink from "next/link";
import clsx from "clsx";
import { ThemeSwitch } from "@/components/theme-switch";
import { GithubIcon, DiscordIcon } from "./icons";
import { NavbarProfile } from "./navbar.profile";
import NextLink from "next/link";
// import { Logo } from "./icons";
import React from "react";

import { DiscordIcon, GithubIcon } from "./icons";
import { NavbarProfile } from "./navbar.profile";

export const Navbar = () => {
return (
<NextUINavbar maxWidth="xl" position="sticky">
Expand All @@ -34,7 +35,7 @@ export const Navbar = () => {
<NextLink
className={clsx(
linkStyles({ color: "foreground" }),
"data-[active=true]:font-medium data-[active=true]:text-primary",
"data-[active=true]:text-primary data-[active=true]:font-medium",
)}
color="foreground"
href={item.href}
Expand All @@ -57,33 +58,23 @@ export const Navbar = () => {
{/* <Link isExternal href={siteConfig.links.github} aria-label="Github">
<GithubIcon className="text-default-500" />
</Link> */}
<ThemeSwitch className={undefined} classNames={undefined} />
<ThemeSwitch />
<NavbarProfile />
</NavbarItem>
<NavbarItem className="hidden lg:flex"></NavbarItem>
</NavbarContent>

<NavbarContent className="basis-1 pl-4 sm:hidden" justify="end">
<ThemeSwitch className={undefined} classNames={undefined} />
<NavbarProfile />
<ThemeSwitch />
<NavbarMenuToggle />
<NavbarProfile />
</NavbarContent>

<NavbarMenu>
<div className="mx-4 mt-2 flex flex-col gap-2">
{siteConfig.navMenuItems.map((item, index) => (
<NavbarMenuItem key={`${item}-${index}`}>
<Link
color={
index === 2
? "primary"
: index === siteConfig.navMenuItems.length - 1
? "danger"
: "foreground"
}
href="#"
size="lg"
>
<Link color="foreground" href={item.href} size="lg">
{item.label}
</Link>
</NavbarMenuItem>
Expand Down
23 changes: 12 additions & 11 deletions Client/src/components/navbar.profile.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React, { useState, useEffect } from "react";
import { Link } from "@nextui-org/link";
import {
Avatar,
DropdownTrigger,
Button,
Dropdown,
DropdownMenu,
DropdownItem,
Button,
DropdownMenu,
DropdownTrigger,
} from "@nextui-org/react";
import { useSession, signOut } from "next-auth/react";
import { useRouter } from "next/router";
import { Link } from "@nextui-org/link";
import { signOut, useSession } from "next-auth/react";
import React, { useEffect, useState } from "react";

import SkeletonComponent from "./skeleton";

export const NavbarProfile = () => {
Expand Down Expand Up @@ -42,8 +43,8 @@ export const NavbarProfile = () => {
if (!session?.user) {
return (
<Button
disabled={isLogin}
color="primary"
disabled={isLogin}
onClick={() => openURL("/account/login")}
>
เข้าสู่ระบบ
Expand All @@ -57,10 +58,10 @@ export const NavbarProfile = () => {
<SkeletonComponent />
) : (
<Avatar
isBordered
as="button"
className="transition-transform"
color="default"
isBordered
name={session.user?.name}
size="sm"
src={session.user?.image}
Expand All @@ -69,13 +70,13 @@ export const NavbarProfile = () => {
</DropdownTrigger>
<DropdownMenu
aria-label="Profile Actions"
variant="flat"
onAction={(key) => Actions(key)}
variant="flat"
>
<DropdownItem
key="profile"
className="h-14 gap-2"
href="/contents/profile"
key="profile"
>
<p className="font-semibold">ลงชื่อเข้าใช้เป็น</p>
<p className="font-semibold">
Expand All @@ -91,7 +92,7 @@ export const NavbarProfile = () => {
) : null}
<DropdownItem key="payment">จ่ายเงิน</DropdownItem>
<DropdownItem href="/contents/manageteam">จัดการทีม</DropdownItem>
<DropdownItem key="logout" color="danger" className="text-danger">
<DropdownItem className="text-danger" color="danger" key="logout">
ออกจากระบบ
</DropdownItem>
</DropdownMenu>
Expand Down
56 changes: 28 additions & 28 deletions Client/src/components/primitives.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,10 @@
import { tv } from "tailwind-variants";

export const title = tv({
base: "tracking-tight inline font-semibold",
variants: {
color: {
violet: "from-[#FF1CF7] to-[#b249f8]",
yellow: "from-[#FF705B] to-[#FFB457]",
blue: "from-[#5EA2EF] to-[#0072F5]",
cyan: "from-[#00b7fa] to-[#01cfea]",
green: "from-[#6FEE8D] to-[#17c964]",
pink: "from-[#FF72E1] to-[#F54C7A]",
foreground: "dark:from-[#FFFFFF] dark:to-[#4B4B4B]",
},
size: {
sm: "text-3xl lg:text-4xl",
md: "text-[2.3rem] lg:text-5xl leading-9",
lg: "text-4xl lg:text-6xl",
},
fullWidth: {
true: "w-full block",
},
},
defaultVariants: {
size: "md",
},
base: "inline font-semibold tracking-tight",
compoundVariants: [
{
class: "bg-gradient-to-b bg-clip-text text-transparent",
color: [
"violet",
"yellow",
Expand All @@ -35,19 +14,40 @@ export const title = tv({
"pink",
"foreground",
],
class: "bg-clip-text text-transparent bg-gradient-to-b",
},
],
defaultVariants: {
size: "md",
},
variants: {
color: {
blue: "from-[#5EA2EF] to-[#0072F5]",
cyan: "from-[#00b7fa] to-[#01cfea]",
foreground: "dark:from-[#FFFFFF] dark:to-[#4B4B4B]",
green: "from-[#6FEE8D] to-[#17c964]",
pink: "from-[#FF72E1] to-[#F54C7A]",
violet: "from-[#FF1CF7] to-[#b249f8]",
yellow: "from-[#FF705B] to-[#FFB457]",
},
fullWidth: {
true: "block w-full",
},
size: {
lg: "text-4xl lg:text-6xl",
md: "text-[2.3rem] leading-9 lg:text-5xl",
sm: "text-3xl lg:text-4xl",
},
},
});

export const subtitle = tv({
base: "w-full md:w-1/2 my-2 text-lg lg:text-xl text-default-600 block max-w-full",
base: "text-default-600 my-2 block w-full max-w-full text-lg md:w-1/2 lg:text-xl",
defaultVariants: {
fullWidth: true,
},
variants: {
fullWidth: {
true: "!w-full",
},
},
defaultVariants: {
fullWidth: true,
},
});
Loading

0 comments on commit aaea311

Please sign in to comment.