Skip to content

Commit

Permalink
deadcode #96
Browse files Browse the repository at this point in the history
  • Loading branch information
djobbo committed Oct 13, 2023
1 parent f933c16 commit c8be7a7
Show file tree
Hide file tree
Showing 63 changed files with 1,037 additions and 3,314 deletions.
12 changes: 8 additions & 4 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,23 @@
- [x] stats
- [x] clan [clanId] + tabs
- [x] player [playerId] + tabs
- [ ] 400 / 500
- [x] seo metadata
- [x] clean "replays" from copy paste
- [ ] check deadcode
- [ ] Error handling
- [ ] 404
- [ ] 500
- [ ] all pages
- [ ] validate bhapi with zod
- [ ] rename all zod "validators" to "schemas"
- [ ] reduce usage of 'use client' in components
- [ ] clean "replays" from copy paste
- [ ] trpc
- [ ] replace prisma with drizzle
- [x] seo metadata
- [ ] change components to shadcn
- [ ] readd adsense
- [ ] rename favorites to bookmarks
- [ ] add up to 5 localstorage favorites?
- [ ] history?
- [ ] check deadcode
- [ ] migrate providers to zustand
- [ ] sitemap
- [ ] replace icons with lucide.dev icons
2 changes: 1 addition & 1 deletion app/app/(rankings)/RankingsTableItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Image } from "@/components/Image"
import { Progress } from "ui/base/Progress"
import { calculateWinrate } from "bhapi/helpers/calculateWinrate"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import type { Ranking } from "bhapi/types"
import type { ReactNode } from "react"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { type BHClan } from "db/generated/client"
import { CLANS_RANKINGS_PER_PAGE } from "./constants"
import { cleanString } from "common/helpers/cleanString"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { formatUnixTime } from "common/helpers/date"
import { useSearch } from "../../SearchProvider"
import Link from "next/link"
Expand Down
2 changes: 1 addition & 1 deletion app/app/(stats)/clan/[clanId]/ClanStatsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type ClanStatsContext = {
clan: Clan | null
}

export const clanStatsContext = createContext<ClanStatsContext>({
const clanStatsContext = createContext<ClanStatsContext>({
clan: null,
})

Expand Down
2 changes: 1 addition & 1 deletion app/app/(stats)/player/[playerId]/2v2/TeamCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MiscStatGroup } from "@/components/stats/MiscStatGroup"
import { RatingDisplay } from "@/components/stats/RatingDisplay"
import { calculateWinrate } from "bhapi/helpers/calculateWinrate"
import { cleanString } from "common/helpers/cleanString"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { css } from "ui/theme"
import { getLegendEloReset } from "bhapi/calculator"
import { getTierFromRating } from "bhapi/helpers/getTierFromRating"
Expand Down
2 changes: 1 addition & 1 deletion app/app/(stats)/player/[playerId]/PlayerStatsTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { css, theme } from "ui/theme"
import { usePlayerStats } from "./PlayerStatsProvider"
import { useSelectedLayoutSegment } from "next/navigation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ClanIcon } from "ui/icons"
import { CollapsibleSection } from "@/components/layout/CollapsibleSection"
import { MiscStatGroup } from "@/components/stats/MiscStatGroup"
import { cleanString } from "common/helpers/cleanString"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { usePlayerStats } from "../PlayerStatsProvider"

export const ClanContent = () => {
Expand Down
2 changes: 1 addition & 1 deletion app/app/_landing/LandingBackground.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"

type LandingBackgroundProps = {
className?: string
Expand Down
2 changes: 1 addition & 1 deletion app/app/_layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
SearchButton,
SearchButtonIcon,
} from "@/components/search/SearchButton"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { useAuth } from "@/providers/auth/AuthProvider"
import { usePathname } from "next/navigation"
import { useSideNav } from "@/providers/SideNavProvider"
Expand Down
2 changes: 1 addition & 1 deletion app/app/_layout/LayoutContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { bgVar1 } from "ui/theme/theme"
import { styled } from "ui/theme"
import type { ReactNode } from "react"

export type LayoutContentProps = {
type LayoutContentProps = {
children: ReactNode
}

Expand Down
24 changes: 10 additions & 14 deletions app/app/_layout/SideNav.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
"use client"

import { AppLink } from "ui/base/AppLink"
import { DiscordIcon } from "ui/icons"
import {
HiBookOpen,
HiChevronDoubleUp,
HiHeart,
HiHome,
HiLightningBolt,
HiUserGroup,
HiUsers,
HiX,
} from "react-icons/hi"
DiscordIcon,
Rankings1v1Icon,
Rankings2v2Icon,
RankingsPowerIcon,
} from "ui/icons"
import { HiBookOpen, HiHeart, HiHome, HiUserGroup, HiX } from "react-icons/hi"
// TODO: replace react-icons with lucide
import { Image } from "@/components/Image"
import { Tooltip } from "ui/base/Tooltip"
import { cleanString } from "common/helpers/cleanString"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { css } from "ui/theme"
import { legendsMap } from "bhapi/legends"
import { useFavorites } from "@/providers/auth/AuthProvider"
Expand Down Expand Up @@ -123,20 +119,20 @@ const defaultNav: {
},
{
name: "1v1 Rankings",
icon: <HiChevronDoubleUp className="w-6 h-6" />,
icon: <Rankings1v1Icon className="w-6 h-6" />,
href: "/ranked/1v1",
exact: false,
},
{
name: "2v2 Rankings",
icon: <HiUsers className="w-6 h-6" />,
icon: <Rankings2v2Icon className="w-6 h-6" />,
href: "/ranked/2v2",
exact: false,
},
{
name: "Power Rankings",
href: "/power-rankings",
icon: <HiLightningBolt className="w-6 h-6" />,
icon: <RankingsPowerIcon className="w-6 h-6" />,
},
{
name: "Clans",
Expand Down
2 changes: 1 addition & 1 deletion app/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SearchButton } from "@/components/search/SearchButton"
import { SectionTitle } from "@/components/layout/SectionTitle"
import { Suspense } from "react"
import { WeeklyRotation } from "./_landing/WeeklyRotation"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { css } from "ui/theme"
import Link from "next/link"

Expand Down
2 changes: 1 addition & 1 deletion app/components/BackToTopButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { BackToTopIcon } from "ui/icons"
import { Tooltip } from "ui/base/Tooltip"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { useEffect, useState } from "react"
import { useWindowScroll } from "common/hooks/useWindowScroll"

Expand Down
2 changes: 1 addition & 1 deletion app/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import NextImage from "next/image"
import type { ImageProps as NextImageProps } from "next/image"

Expand Down
2 changes: 1 addition & 1 deletion app/components/favorites/FavoritesGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AppLink } from "ui/base/AppLink"
import { ClanIcon, CloseIcon } from "ui/icons"
import { Image } from "@/components/Image"
import { cleanString } from "common/helpers/cleanString"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { css } from "ui/theme"
import { legendsMap } from "bhapi/legends"
import { useFavorites } from "@/providers/auth/AuthProvider"
Expand Down
2 changes: 1 addition & 1 deletion app/components/layout/CollapsibleContent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CollapseSectionIcon, ExpandSectionIcon } from "ui/icons"
import { Content, Root, Trigger } from "@radix-ui/react-collapsible"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { useState } from "react"
import type { ReactNode } from "react"

Expand Down
2 changes: 1 addition & 1 deletion app/components/layout/CollapsibleSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CollapsibleContent } from "./CollapsibleContent"
import { SectionTitle } from "./SectionTitle"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import type { CollapsibleContentProps } from "./CollapsibleContent"
import type { ReactNode } from "react"

Expand Down
2 changes: 1 addition & 1 deletion app/components/layout/SectionTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import type { ReactNode } from "react"

type SectionTitleProps = {
Expand Down
2 changes: 1 addition & 1 deletion app/components/search/SearchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Kbd } from "ui/base/Kbd"
import { SearchIcon } from "ui/icons"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { useDevice } from "common/hooks/useDevice"
import { useKBar } from "kbar"

Expand Down
2 changes: 1 addition & 1 deletion app/components/stats/GamesDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Progress } from "ui/base/Progress"
import { calculateWinrate } from "bhapi/helpers/calculateWinrate"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import type { ReactNode } from "react"

type GamesCardProps = {
Expand Down
2 changes: 1 addition & 1 deletion app/components/stats/GeneralStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Card } from "ui/base/Card"
import { GamesDisplay } from "./GamesDisplay"
import { MiscStatGroup } from "./MiscStatGroup"
import { ProgressCard } from "./ProgressCard"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"

type GeneralStatsProps = {
className?: string
Expand Down
2 changes: 1 addition & 1 deletion app/components/stats/MiscStatGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Tooltip } from "ui/base/Tooltip"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { css } from "ui/theme"
import type { ReactNode } from "react"

Expand Down
2 changes: 1 addition & 1 deletion app/components/stats/StatsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button } from "ui/base/Button"
import { MiscStatGroup } from "./MiscStatGroup"
import { ShareIcon } from "ui/icons"
import { cleanString } from "common/helpers/cleanString"
import { cn } from "common/helpers/classnames"
import { cn } from "@/lib/utils"
import { useAuth, useFavorites } from "@/providers/auth/AuthProvider"
import { useCopyToClipboard } from "common/hooks/useCopyToClipboard"
import toast from "react-hot-toast"
Expand Down
13 changes: 0 additions & 13 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
},
"dependencies": {
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-slider": "^1.1.2",
"@radix-ui/react-slot": "^1.0.2",
"@tanstack/react-query": "^4.35.7",
"@trpc/client": "^10.40.0",
"@trpc/react-query": "^10.40.0",
Expand All @@ -25,45 +23,34 @@
"@types/react-dom": "18.2.11",
"autoprefixer": "10.4.16",
"bhapi": "workspace:*",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"common": "workspace:*",
"db": "workspace:*",
"drizzle-orm": "^0.28.6",
"drizzle-zod": "^0.5.1",
"eslint": "8.51.0",
"eslint-config-next": "13.5.4",
"immer": "^10.0.3",
"kbar": "0.1.0-beta.39",
"logger": "workspace:*",
"lucide-react": "^0.284.0",
"next": "13.5.4",
"pg": "^8.11.3",
"postcss": "8.4.31",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.7.1",
"react-youtube": "^10.1.0",
"superjson": "^1.13.3",
"tailwind-merge": "^1.14.0",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.7",
"typescript": "5.2.2",
"ui": "workspace:*",
"uuid": "^9.0.1",
"web-parser": "workspace:*",
"zod": "^3.22.4",
"zustand": "^4.4.3"
},
"devDependencies": {
"@types/pg": "^8.10.3",
"@types/uuid": "^9.0.5",
"@types/youtube-player": "^5.5.8",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"drizzle-kit": "^0.19.13",
"eslint-plugin-prettier": "^5.0.0",
"prettier": "^3.0.3",
"tsx": "^3.13.0"
}
}
2 changes: 1 addition & 1 deletion app/server/router/users/getSingleUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { eq } from "drizzle-orm"
import { publicProcedure } from "../../trpc"
import { z } from "zod"

export const getSingleReplay = publicProcedure
export const getSingleUser = publicProcedure
.input(z.string().optional().nullable())
.query(async ({ input: id }) => {
if (!id) return null
Expand Down
4 changes: 2 additions & 2 deletions app/server/router/users/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getSingleReplay } from "./getSingleUser"
import { getSingleUser } from "./getSingleUser"
import { router } from "../../trpc"

export const usersRouter = router({
getSingle: getSingleReplay,
getSingle: getSingleUser,
})
13 changes: 13 additions & 0 deletions knip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { KnipConfig } from "knip"

const config: KnipConfig = {
ignore: [
"**/.next/**",
"packages/db/generated/**",
"**/reaccord.config.js",
// TODO: remove this
"packages/server/**",
],
}

export default config
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
"db:migrate:prod": "turbo run db:migrate:prod --scope=db --include-dependencies --no-deps",
"build:prod": "pnpm db:migrate:prod && turbo run build --scope=app --include-dependencies --no-deps",
"dev": "turbo run dev --parallel",
"setup:env": "zx setup.zx.mjs"
"setup:env": "zx setup.zx.mjs",
"deadcode": "knip --no-gitignore --reporter compact"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.51.0",
"eslint-config-next": "^13.1.1",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"knip": "^2.33.3",
"prettier": "^3.0.3",
"turbo": "^1.10.15",
"typescript": "^4.9.4",
Expand Down
Loading

0 comments on commit c8be7a7

Please sign in to comment.