test
Seto Elkahfi committed
Aug 4, 2024 at 17:48 UTC
46f7cc8276624c3d205a841f92be8096e6f89823
30 files changed
+52
-49
frontend/splitfire-desktop/.eslintrc.json
new
+3
@@ -0,0 +1,3 @@
1
+{
2
+ "extends": "next/core-web-vitals"
3
+}
\ No newline at end of file
frontend/splitfire-desktop/_lib/params.ts
renamed
frontend/splitfire-desktop/_ui/LoadingView.tsx
renamed
frontend/splitfire-desktop/_ui/address-bar.tsx
renamed
+1
-1
@@ -3,7 +3,7 @@
3
import React from 'react';
4
import { usePathname } from 'next/navigation';
5
import { HomeIcon } from '@heroicons/react/solid';
6
-import { useLogger } from '../../lib/logger';
6
+import { useLogger } from '../lib/logger';
7
8
export function AddressBar() {
9
const log = useLogger('AddressBar');
frontend/splitfire-desktop/_ui/boundary.tsx
renamed
frontend/splitfire-desktop/_ui/click-counter.tsx
renamed
frontend/splitfire-desktop/_ui/components/button.tsx
renamed
frontend/splitfire-desktop/_ui/components/external-link.tsx
renamed
frontend/splitfire-desktop/_ui/components/icons.tsx
renamed
frontend/splitfire-desktop/_ui/components/tooltip.tsx
renamed
frontend/splitfire-desktop/_ui/external-link.tsx
renamed
frontend/splitfire-desktop/_ui/global-nav.tsx
renamed
+2
-2
@@ -7,9 +7,9 @@ import { MenuAlt2Icon, XIcon } from '@heroicons/react/solid';
7
import clsx from 'clsx';
8
import { useContext, useState } from 'react';
9
import Image from 'next/image';
10
-import { UserContext } from '../../lib/current-user-context';
10
+import { UserContext } from '../lib/current-user-context';
11
import { useLogger } from '@/lib/logger';
12
-import { PARAMS_USER_ID } from '@/app/_lib/params';
12
+import { PARAMS_USER_ID } from '@/_lib/params';
13
14
export function GlobalNav() {
15
frontend/splitfire-desktop/_ui/menus.ts
renamed
frontend/splitfire-desktop/_ui/skeleton-card.tsx
new
+18
@@ -0,0 +1,18 @@
1
+"use client";
2
+
3
+import clsx from "clsx";
4
+
5
+export const SkeletonCard = ({ isLoading }: { isLoading?: boolean }) => (
6
+ <div
7
+ className={clsx("rounded-2xl bg-gray-900/80 p-4", {
8
+ "relative overflow-hidden before:absolute before:inset-0 before:-translate-x-full before:animate-[shimmer_1.5s_infinite] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent":
9
+ isLoading,
10
+ })}
11
+ >
12
+ <div className="space-y-3">
13
+ <div className="h-14 rounded-lg bg-gray-700" />
14
+ <div className="h-3 w-11/12 rounded-lg bg-gray-700" />
15
+ <div className="h-3 w-8/12 rounded-lg bg-gray-700" />
16
+ </div>
17
+ </div>
18
+);
\ No newline at end of file
frontend/splitfire-desktop/_ui/song-provider-card.tsx
renamed
+4
-21
@@ -1,24 +1,7 @@
1
-"use client";
2
-
3
-import clsx from "clsx";
1
import { SongProvider } from "@/models/song-response";
5
-import Image from "next/image";
2
+import clsx from "clsx";
3
import { useRouter } from "next/navigation";
7
-
8
-export const SkeletonCard = ({ isLoading }: { isLoading?: boolean }) => (
9
- <div
10
- className={clsx("rounded-2xl bg-gray-900/80 p-4", {
11
- "relative overflow-hidden before:absolute before:inset-0 before:-translate-x-full before:animate-[shimmer_1.5s_infinite] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent":
12
- isLoading,
13
- })}
14
- >
15
- <div className="space-y-3">
16
- <div className="h-14 rounded-lg bg-gray-700" />
17
- <div className="h-3 w-11/12 rounded-lg bg-gray-700" />
18
- <div className="h-3 w-8/12 rounded-lg bg-gray-700" />
19
- </div>
20
- </div>
21
-);
4
+import Image from "next/image";
5
6
export enum SongProviderPath {
7
PLAY = "play",
@@ -26,13 +9,13 @@ export enum SongProviderPath {
9
}
10
11
// duplicate skeleton-card.tsx
29
-export const SongProviderCard = ({
12
+export function SongProviderCard({
13
songProvider,
14
path,
15
}: {
16
songProvider: SongProvider;
17
path: SongProviderPath;
35
-}) => {
18
+}) {
19
const router = useRouter();
20
let queryString = `songProviderId=${songProvider.id}`;
21
if (path === SongProviderPath.PLAY && songProvider.audio_file) {
frontend/splitfire-desktop/_ui/tab-group.tsx
renamed
frontend/splitfire-desktop/_ui/tab-nav-item.tsx
renamed
frontend/splitfire-desktop/_ui/tab.tsx
renamed
+1
-1
@@ -1,6 +1,6 @@
1
'use client';
2
3
-import type { Item } from '@/app/_ui/tab-group';
3
+import type { Item } from '@/_ui/tab-group';
4
import clsx from 'clsx';
5
import Link from 'next/link';
6
import { useSelectedLayoutSegment } from 'next/navigation';
frontend/splitfire-desktop/app/components/index.tsx
+3
-4
@@ -6,11 +6,10 @@ import { SongProvider } from "@/models/song-response";
6
import { invoke } from "@tauri-apps/api";
7
import { useState, useEffect } from "react";
8
import {
9
- SkeletonCard,
10
- SongProviderCard,
11
- SongProviderPath,
12
-} from "../_ui/skeleton-card";
9
+ SkeletonCard
10
+} from "../../_ui/skeleton-card";
11
import { useLogger } from "@/lib/logger";
12
+import { SongProviderCard, SongProviderPath } from "../../_ui/song-provider-card";
13
14
export default function Index() {
15
frontend/splitfire-desktop/app/debug/page.tsx
+2
-2
@@ -6,11 +6,11 @@ import {
6
TAURI_GET_ENVIRONMENT,
7
TAURI_SET_ENVIRONMENT,
8
} from "@/lib/tauri-handler";
9
-import { Button } from "@/app/_ui/components/button";
9
+import { Button } from "@/_ui/components/button";
10
import { useEffect, useState } from "react";
11
import { TauriResponse } from "@/models/shared";
12
import { useLogger } from "@/lib/logger";
13
-import { LoadingView } from "@/app/_ui/LoadingView";
13
+import { LoadingView } from "@/_ui/LoadingView";
14
15
enum State {
16
LOADING,
frontend/splitfire-desktop/app/layout.tsx
+5
-3
@@ -1,9 +1,9 @@
1
"use client";
2
3
-import { AddressBar } from "./_ui/address-bar";
4
-import { GlobalNav } from "./_ui/global-nav";
3
+import { AddressBar } from "../_ui/address-bar";
4
+import { GlobalNav } from "../_ui/global-nav";
5
import "./globals.css";
6
-import { useEffect, useState } from "react";
6
+import { Suspense, useEffect, useState } from "react";
7
import { CurrentUser, CurrentUserType, db } from "../lib/db";
8
import { UserContext } from "../lib/current-user-context";
9
import { useLogger } from "../lib/logger";
@@ -72,6 +72,7 @@ export default function RootLayout({
72
return (
73
<html lang="en" className="[color-scheme:dark]">
74
<body className="bg-gray-1100 overflow-none bg-[url('/grid.svg')] pb-36">
75
+ <Suspense>
76
<UserContext.Provider value={{ user, updateUser }}>
77
<GlobalNav />
78
<div className="lg:pl-72">
@@ -89,6 +90,7 @@ export default function RootLayout({
90
</div>
91
</div>
92
</UserContext.Provider>
93
+ </Suspense>
94
</body>
95
</html>
96
);
frontend/splitfire-desktop/app/login/page.tsx
+2
-2
@@ -3,7 +3,7 @@
3
import * as Form from "@radix-ui/react-form";
4
import { invoke } from "@tauri-apps/api/tauri";
5
import { TAURI_ACCOUNT_LOGIN } from "@/lib/tauri-handler";
6
-import { Button } from "@/app/_ui/components/button";
6
+import { Button } from "@/_ui/components/button";
7
import { useState } from "react";
8
import { UserContext } from "@/lib/current-user-context";
9
import { CurrentUser, CurrentUserType, db } from "@/lib/db";
@@ -11,7 +11,7 @@ import { AccountLoginResponse } from "@/models/account";
11
import { useRouter } from "next/navigation";
12
import { TauriResponse } from "@/models/shared";
13
import { Mode } from "@/models/mode";
14
-import { LoadingView } from "@/app/_ui/LoadingView";
14
+import { LoadingView } from "@/_ui/LoadingView";
15
import { useLogger } from "@/lib/logger";
16
17
enum State {
frontend/splitfire-desktop/app/logout/page.tsx
+1
-1
@@ -7,7 +7,7 @@ import { CurrentUser, db } from "../../lib/db";
7
import { invoke } from "@tauri-apps/api/tauri";
8
import { TAURI_ACCOUNT_LOGOUT } from "../../lib/tauri-handler";
9
import { useRouter } from "next/navigation";
10
-import { Button } from "../_ui/components/button";
10
+import { Button } from "../../_ui/components/button";
11
12
enum State {
13
LOADING,
frontend/splitfire-desktop/app/play/page.tsx
+1
-1
@@ -5,7 +5,7 @@ import { useContext, useEffect, useState } from "react";
5
import { TAURI_PLAYER_PREPARE } from "../../lib/tauri-handler";
6
import { useRouter, useSearchParams } from "next/navigation";
7
import { useLogger } from "../../lib/logger";
8
-import { IconSpinner } from "../_ui/components/icons";
8
+import { IconSpinner } from "../../_ui/components/icons";
9
import { PlayerPrepareResponse } from "@/models/content";
10
import { TauriResponse } from "@/models/shared";
11
import Player from "./_components/player";
frontend/splitfire-desktop/app/profile/components/index.tsx
+1
-1
@@ -12,7 +12,7 @@ import { TauriResponse } from "@/models/shared";
12
import { LocationMarkerIcon } from "@heroicons/react/solid";
13
import { GearIcon } from "@radix-ui/react-icons";
14
import Link from "next/link";
15
-import { PARAMS_USER_ID } from "@/app/_lib/params";
15
+import { PARAMS_USER_ID } from "@/_lib/params";
16
import { UserContext } from "@/lib/current-user-context";
17
18
enum State {
frontend/splitfire-desktop/app/ready-to-play/page.tsx
+4
-3
@@ -3,9 +3,10 @@
3
import { ContentCarouselResponse } from "@/models/content";
4
import { invoke } from "@tauri-apps/api";
5
import { useEffect, useState } from "react";
6
-import { TAURI_CONTENT_READY_TO_PLAY } from "../../lib/tauri-handler";
7
-import { SkeletonCard, SongProviderCard, SongProviderPath } from "../_ui/skeleton-card";
8
-import { SongProvider } from "../../models/song-response";
6
+import { TAURI_CONTENT_READY_TO_PLAY } from "@/lib/tauri-handler";
7
+import { SkeletonCard } from "@/_ui/skeleton-card";
8
+import { SongProvider } from "@/models/song-response";
9
+import { SongProviderCard, SongProviderPath } from "@/_ui/song-provider-card";
10
11
export default function Page() {
12
const [songProviders, setSongProviders] = useState<SongProvider[]>([]);
frontend/splitfire-desktop/app/register/components/signup-form.tsx
+1
-1
@@ -7,7 +7,7 @@ import { TauriResponse } from "@/models/shared";
7
import { invoke } from "@tauri-apps/api";
8
import { useState } from "react";
9
import * as Form from "@radix-ui/react-form";
10
-import { Button } from "@/app/_ui/components/button";
10
+import { Button } from "@/_ui/components/button";
11
12
type SignupFormPayload = {
13
name: string,
frontend/splitfire-desktop/app/split/_components/button-split.tsx
+1
-1
@@ -67,7 +67,7 @@ export default function ButtonGenerateBackingTracks({
67
if (isDoneSplitting) {
68
return (
69
<div className="mb-3 mt-3">
70
- <h1 className="">Let's Play!</h1>
70
+ <h1 className="">Let's Play!</h1>
71
</div>
72
);
73
} else if (isCurrentlySplitting) {
frontend/splitfire-desktop/app/split/_components/voters-view.tsx
+1
-1
@@ -1,6 +1,6 @@
1
"use client";
2
3
-import { PARAMS_USER_ID } from '@/app/_lib/params';
3
+import { PARAMS_USER_ID } from '@/_lib/params';
4
import Image from "next/image";
5
import Link from "next/link";
6
import { VoteType } from "./votes-view-main";
frontend/splitfire-desktop/app/top-voted/components/index.tsx
+1
-4
@@ -1,6 +1,6 @@
1
"use client";
2
3
-import { SkeletonCard, SongProviderCard, SongProviderPath } from "@/app/_ui/skeleton-card";
3
+import { SkeletonCard } from "@/_ui/skeleton-card";
4
import { useLogger } from "@/lib/logger";
5
import { TAURI_CONTENT_TOP_VOTED } from "@/lib/tauri-handler";
6
import { ContentCarouselResponse } from "@/models/content";
@@ -35,9 +35,6 @@ export default function Index() {
35
{ songProviders.length === 0 && Array.from({ length: 6 }).map((_, i) => (
36
<SkeletonCard key={i} isLoading={true} />
37
))}
38
- { songProviders.length > 0 && songProviders.map((SongProvider, i) => (
39
- <SongProviderCard key={i} songProvider={SongProvider} path={SongProviderPath.SPLIT} />
40
- ))}
38
</div>
39
</div>
40
</div>