Skip to content

Commit

Permalink
move Scenes to separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Asvarox committed May 25, 2024
1 parent 0b3b275 commit 138730c
Show file tree
Hide file tree
Showing 466 changed files with 1,632 additions and 1,593 deletions.
2 changes: 1 addition & 1 deletion .storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Global } from '@emotion/react';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { useMemo } from 'react';
import '../src/index.css';
import styles from '../src/styles';
import styles from '../src/modules/Elements/baseStyles';

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand Down
23 changes: 11 additions & 12 deletions .unimportedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,25 @@
],
"rootDir": "./src",
"ignoreUnimported": [
"src/Scenes/Game/Singing/Input/MicStrategies/Yin.ts",
"src/Songs/utils/song-fixture.ts",
"src/hooks/useCallbackDebugger.ts",
"src/hooks/useMemoDebugger.ts",
"src/hooks/useEffectDebugger.ts",
"src/modules/GameEngine/Input/MicStrategies/Yin.ts",
"src/modules/Songs/utils/song-fixture.ts",
"src/modules/hooks/useCallbackDebugger.ts",
"src/modules/hooks/useEffectDebugger.ts",
"src/modules/hooks/useMemoDebugger.ts",
"src/modules/utils/TestCanvas.tsx",
"src/modules/utils/delayPromise.ts",
"src/modules/utils/testUtils.ts",
"src/setupTests.ts",
"src/stories/songFixture.ts",
"src/utils/TestCanvas.tsx",
"src/utils/delayPromise.ts",
"src/utils/range.ts",
"src/utils/testUtils.ts"
"src/stories/songFixture.ts"
],
"ignoreUnused": [
"@mui/system",
"@mui/x-date-pickers"
],
"ignoreUnresolved": [
"../../../public/logo.svg?raw",
"Scenes/Game/Singing/GameOverlay/Drawing/Shaders/shader.frag?raw",
"Scenes/Game/Singing/GameOverlay/Drawing/Shaders/shader.vert?raw",
"modules/GameEngine/Drawing/Shaders/shader.frag?raw",
"modules/GameEngine/Drawing/Shaders/shader.vert?raw",
"utility-types"
],
"entry": [
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Diff not rendered.
Diff not rendered.
3 changes: 3 additions & 0 deletions playwright/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Testing Page</title>
<script>
var global = window; // Some scripts rely on `global` which is node-only
</script>
</head>
<body>
<div id="root"></div>
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/cicd/githubActionImportSongs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dotenv from 'dotenv';
import fs from 'fs';
import convertSongToTxt from '../../src/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../../src/Songs/utils/convertTxtToSong';
import convertSongToTxt from '../../src/modules/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../../src/modules/Songs/utils/convertTxtToSong';

dotenv.config({ path: '.env.local' });

Expand Down
2 changes: 1 addition & 1 deletion scripts/convert-songs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readdirSync, readFileSync, writeFileSync } from 'fs';
import convertSongToTxt from '../src/Songs/utils/convertSongToTxt';
import convertSongToTxt from '../src/modules/Songs/utils/convertSongToTxt';

const songs = readdirSync('./tests/fixtures/songs/')
.filter((file) => file.endsWith('.json'))
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateIndex.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs, { readdirSync, readFileSync } from 'fs';
import { Song, SongPreview } from 'interfaces';
import { getSongPreview } from '../src/Songs/utils';
import convertTxtToSong from '../src/Songs/utils/convertTxtToSong';
import { getSongPreview } from '../src/modules/Songs/utils';
import convertTxtToSong from '../src/modules/Songs/utils/convertTxtToSong';

const SONGS_FOLDER = './public/songs';

Expand Down
2 changes: 1 addition & 1 deletion scripts/generateSongStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ songStats.videoIds = uniq(
songStats.artists = shuffle(uniq(index.filter((song) => song.language[0] === 'English').map((song) => song.artist)));
songStats.songs = index.length;

writeFileSync('./src/Scenes/LandingPage/songStats.json', JSON.stringify(songStats, undefined, 2));
writeFileSync('./src/routes/LandingPage/songStats.json', JSON.stringify(songStats, undefined, 2));
6 changes: 3 additions & 3 deletions scripts/getSharedSongs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import dotenv from 'dotenv';
import fs from 'fs';
import { SongPreview } from 'interfaces';
import currentSongs from '../public/songs/index.json';
import convertSongToTxt from '../src/Songs/utils/convertSongToTxt';
import { importSongsFromPostHogBase } from '../src/Songs/utils/importSongsFromPostHogBase';
import { SongPreview } from '../src/interfaces';
import convertSongToTxt from '../src/modules/Songs/utils/convertSongToTxt';
import { importSongsFromPostHogBase } from '../src/modules/Songs/utils/importSongsFromPostHogBase';

dotenv.config({ path: '.env.local' });

Expand Down
10 changes: 5 additions & 5 deletions scripts/processSongs.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { readdirSync, readFileSync, writeFileSync } from 'fs';
import { Song } from 'interfaces';
import { IArtistList, MusicBrainzApi } from 'musicbrainz-api';
import { IIsrcSearchResult } from 'musicbrainz-api/lib/musicbrainz.types';
import { Song } from '../src/interfaces';
import { fixDiacritics } from '../src/Scenes/Convert/Steps/utils/fixDiacritics';
import convertSongToTxt from '../src/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../src/Songs/utils/convertTxtToSong';
import clearString from '../src/utils/clearString';
import convertSongToTxt from '../src/modules/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../src/modules/Songs/utils/convertTxtToSong';
import clearString from '../src/modules/utils/clearString';
import { fixDiacritics } from '../src/routes/Convert/Steps/utils/fixDiacritics';
// @ts-ignore
import escSongs from './escSongs.json';
// @ts-ignore
Expand Down
6 changes: 3 additions & 3 deletions scripts/restoreOrigins.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readdirSync, readFileSync, writeFileSync } from 'fs';
import { Song } from '../src/interfaces';
import convertSongToTxt from '../src/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../src/Songs/utils/convertTxtToSong';
import { Song } from 'interfaces';
import convertSongToTxt from '../src/modules/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../src/modules/Songs/utils/convertTxtToSong';
// @ts-ignore
import scrapedBpmData from './bandOrigins.json';
// @ts-ignore
Expand Down
6 changes: 2 additions & 4 deletions scripts/storeOrigins.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { readdirSync, readFileSync, writeFileSync } from 'fs';
import { Song } from '../src/interfaces';
import convertTxtToSong from '../src/Songs/utils/convertTxtToSong';
// @ts-ignore
// @ts-ignore
import { Song } from 'interfaces';
import convertTxtToSong from '../src/modules/Songs/utils/convertTxtToSong';

const SONGS_FOLDER = './public/songs';

Expand Down
4 changes: 2 additions & 2 deletions scripts/updateLastUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Song } from 'interfaces';
import { IArtistList, MusicBrainzApi } from 'musicbrainz-api';
import * as process from 'process';
import songIndex from '../public/songs/index.json';
import convertSongToTxt from '../src/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../src/Songs/utils/convertTxtToSong';
import convertSongToTxt from '../src/modules/Songs/utils/convertSongToTxt';
import convertTxtToSong from '../src/modules/Songs/utils/convertTxtToSong';

const foundOrigins: Record<string, string> = {};
const files = process.argv.slice(2);
Expand Down
44 changes: 22 additions & 22 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { ErrorBoundary, withProfiler } from '@sentry/react';
import { KeyboardHelpProvider } from 'Scenes/KeyboardHelp/Context';
import RemoteMic from 'Scenes/RemoteMic/RemoteMic';
import Settings from 'Scenes/Settings/Settings';
import { KeyboardHelpProvider } from 'routes/KeyboardHelp/Context';
import RemoteMic from 'routes/RemoteMic/RemoteMic';
import Settings from 'routes/Settings/Settings';
import { Route, Router, Switch } from 'wouter';
import Convert from './Scenes/Convert/Convert';
import Edit from './Scenes/Edit/Edit';
import Jukebox from './Scenes/Jukebox/Jukebox';
import SelectInput from './Scenes/SelectInput/SelectInput';
import Convert from './routes/Convert/Convert';
import Edit from './routes/Edit/Edit';
import Jukebox from './routes/Jukebox/Jukebox';
import SelectInput from './routes/SelectInput/SelectInput';

import { Global, css } from '@emotion/react';
import { Theme, ThemeProvider, createTheme } from '@mui/material/styles';
import { ErrorFallback } from 'Elements/ErrorFallback';
import LayoutWithBackgroundProvider from 'Elements/LayoutWithBackground';
import PageLoader from 'Elements/PageLoader';
import GetSongsBPMs from 'Scenes/Edit/GetSongsBPMs';
import ExcludeLanguages from 'Scenes/ExcludeLanguages/ExcludeLanguages';
import Game from 'Scenes/Game/Game';
import LandingPage from 'Scenes/LandingPage/LandingPage';
import ManageSongs from 'Scenes/ManageSongs/ManageSongs';
import QuickSetup from 'Scenes/QuickSetup/QuickSetup';
import RemoteMicSettings from 'Scenes/Settings/RemoteMicSettings';
import { GraphicSetting, MobilePhoneModeSetting, useSettingValue } from 'Scenes/Settings/SettingsState';
import SocialMediaElements from 'Scenes/SocialMediaElements/SocialMediaElements';
import Welcome from 'Scenes/Welcome/Welcome';
import { ErrorFallback } from 'modules/Elements/ErrorFallback';
import LayoutWithBackgroundProvider from 'modules/Elements/LayoutWithBackground';
import PageLoader from 'modules/Elements/PageLoader';
import { Suspense, lazy, useMemo } from 'react';
import routePaths from 'routePaths';
import GetSongsBPMs from 'routes/Edit/GetSongsBPMs';
import ExcludeLanguages from 'routes/ExcludeLanguages/ExcludeLanguages';
import Game from 'routes/Game/Game';
import LandingPage from 'routes/LandingPage/LandingPage';
import ManageSongs from 'routes/ManageSongs/ManageSongs';
import QuickSetup from 'routes/QuickSetup/QuickSetup';
import RemoteMicSettings from 'routes/Settings/RemoteMicSettings';
import { GraphicSetting, MobilePhoneModeSetting, useSettingValue } from 'routes/Settings/SettingsState';
import SocialMediaElements from 'routes/SocialMediaElements/SocialMediaElements';
import Welcome from 'routes/Welcome/Welcome';
import routePaths from 'routes/routePaths';

const LazySongList = lazy(() => import('./Scenes/Edit/SongList'));
const LazySongList = lazy(() => import('./routes/Edit/SongList'));

// Commenting this out as there are many failed to fetch errors coming from Googlebot
// // This is a hack to preload the game scene so that it's ready when the user clicks on the game button
Expand Down
4 changes: 0 additions & 4 deletions src/GameEvents/eventListeners.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/RemoteMic/Network/Client.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/RemoteMic/Network/Server.ts

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions src/Songs/utils/processSong/processSong.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/Stats/index.ts

This file was deleted.

28 changes: 0 additions & 28 deletions src/Stats/players.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/emotion-theme.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphicsLevel } from 'Scenes/Settings/SettingsState';
import { GraphicsLevel } from 'routes/Settings/SettingsState';
import { ValuesType } from 'utility-types';

declare module '@emotion/react' {
Expand Down
6 changes: 0 additions & 6 deletions src/hooks/players/useRecentPlayerNames.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { typesMap } from 'Songs/utils/convertTxtToSong';
import { typesMap } from 'modules/Songs/utils/convertTxtToSong';
import { ValuesType } from 'utility-types';

export type NoteType = ValuesType<typeof typesMap>;
Expand Down
39 changes: 20 additions & 19 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import createCache from '@emotion/cache';
import { CacheProvider } from '@emotion/react';
import 'GameEvents/eventListeners';
import 'Stats';
import 'utils/array-at-polyfill';
import 'utils/array-findLastIndex-polyfill';
import 'utils/exposeSingletons';
import 'utils/wdyr';
import 'modules/GameEvents/eventListeners';
import 'modules/Stats';
import 'modules/utils/array-at-polyfill';
import 'modules/utils/array-findLastIndex-polyfill';
import 'modules/utils/exposeSingletons';
import 'modules/utils/wdyr';

import { browserTracingIntegration, init, setUser } from '@sentry/react';
import songStats from 'Scenes/LandingPage/songStats.json';
import { normalizeSting } from 'Songs/utils/getSongId';
import App from 'App';
import 'index.css';
import { normalizeSting } from 'modules/Songs/utils/getSongId';
import isDev from 'modules/utils/isDev';
import isE2E from 'modules/utils/isE2E';
import isPreRendering from 'modules/utils/isPreRendering';
import { randomInt } from 'modules/utils/randomValue';
import sentryIgnoreErrors from 'modules/utils/sentryIgnoreErrors';
import storage from 'modules/utils/storage';
import posthog from 'posthog-js';
import { createRoot } from 'react-dom/client';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import isDev from 'utils/isDev';
import isE2E from 'utils/isE2E';
import isPreRendering from 'utils/isPreRendering';
import { randomInt } from 'utils/randomValue';
import sentryIgnoreErrors from 'utils/sentryIgnoreErrors';
import songStats from 'routes/LandingPage/songStats.json';
import { v4 } from 'uuid';
import App from './App';
import './index.css';

const isSentryEnabled = !!import.meta.env.VITE_APP_SENTRY_DSN_URL;

Expand Down Expand Up @@ -49,13 +50,13 @@ if (!isE2E() && import.meta.env.VITE_APP_POSTHOG_KEY) {
// debug: true,
api_host: import.meta.env.VITE_APP_POSTHOG_PROXY,
loaded: (ph) => {
let storedUser = localStorage.getItem('posthog-user-id');
let storedUser = storage.local.getItem('posthog-user-id');
if (!storedUser) {
storedUser = v4();
localStorage.setItem('posthog-user-id', storedUser);
storage.local.setItem('posthog-user-id', storedUser);
}
ph.identify(storedUser);
let storedName = localStorage.getItem('posthog-user-name');
let storedName = storage.local.getItem('posthog-user-name');
if (!storedName) {
const words = [...new Set(songStats.artists.flatMap((artist) => normalizeSting(artist).split('-')))].filter(
(word) => word.length <= 10,
Expand All @@ -65,7 +66,7 @@ if (!isE2E() && import.meta.env.VITE_APP_POSTHOG_KEY) {
.fill(0)
.map(() => words[randomInt(0, words.length - 1)])
.join('-');
localStorage.setItem('posthog-user-name', storedName);
storage.local.setItem('posthog-user-name', storedName);

ph.alias(storedName, storedUser);
}
Expand Down
Loading

0 comments on commit 138730c

Please sign in to comment.