From 62aef0b7ae74c83d81ffa65b3fff98433b6b55c8 Mon Sep 17 00:00:00 2001 From: srl <906239+srliao@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:39:25 -0400 Subject: [PATCH] revert ads (#2187) --- ui/packages/db/index.html | 9 +-- ui/packages/db/package.json | 1 - ui/packages/db/public/ads.txt | 1 - ui/packages/db/src/Pages/Database/DBVIew.tsx | 2 +- .../db/src/SharedComponents/ActionBar.tsx | 14 ++-- .../db/src/SharedComponents/ListView.tsx | 32 ++++---- .../db/src/SharedComponents/Warning.tsx | 27 ++++--- ui/packages/types/package.json | 5 ++ .../Components/ConfigEditor/ConfigEditor.tsx | 77 +++++++++---------- ui/packages/web/index.html | 9 +-- ui/packages/web/public/ads.txt | 1 - ui/yarn.lock | 12 ++- 12 files changed, 93 insertions(+), 97 deletions(-) delete mode 100644 ui/packages/db/public/ads.txt delete mode 100644 ui/packages/web/public/ads.txt diff --git a/ui/packages/db/index.html b/ui/packages/db/index.html index 66beeb9b38..d0ab3e97cb 100644 --- a/ui/packages/db/index.html +++ b/ui/packages/db/index.html @@ -7,20 +7,15 @@ - gcsim - simulation impact - + -
- + \ No newline at end of file diff --git a/ui/packages/db/package.json b/ui/packages/db/package.json index bd32e76edd..5c23dcc73e 100644 --- a/ui/packages/db/package.json +++ b/ui/packages/db/package.json @@ -17,7 +17,6 @@ "axios": "^1.1.3", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-helmet-async": "^2.0.4", "react-i18next": "^12.0.0", "react-icons": "^4.6.0", "react-infinite-scroll-component": "^6.1.0", diff --git a/ui/packages/db/public/ads.txt b/ui/packages/db/public/ads.txt deleted file mode 100644 index 949751e87e..0000000000 --- a/ui/packages/db/public/ads.txt +++ /dev/null @@ -1 +0,0 @@ -google.com, pub-9129749839418344, DIRECT, f08c47fec0942fa0 \ No newline at end of file diff --git a/ui/packages/db/src/Pages/Database/DBVIew.tsx b/ui/packages/db/src/Pages/Database/DBVIew.tsx index 1e5bb5d9f7..3bc20a28f5 100644 --- a/ui/packages/db/src/Pages/Database/DBVIew.tsx +++ b/ui/packages/db/src/Pages/Database/DBVIew.tsx @@ -15,7 +15,7 @@ type Props = { export const DBView = (props: Props) => { const {t} = useTranslation(); return ( -
+
{props.data.length === 0 ? ( diff --git a/ui/packages/db/src/SharedComponents/ActionBar.tsx b/ui/packages/db/src/SharedComponents/ActionBar.tsx index 28297bcf62..ed4ba474ff 100644 --- a/ui/packages/db/src/SharedComponents/ActionBar.tsx +++ b/ui/packages/db/src/SharedComponents/ActionBar.tsx @@ -1,16 +1,16 @@ -import { useTranslation } from "react-i18next"; -import { CharacterQuickSelect } from "./CharacterQuickSelect"; -import { Filter } from "./Filter"; +import {useTranslation} from 'react-i18next'; +import {CharacterQuickSelect} from './CharacterQuickSelect'; +import {Filter} from './Filter'; -export function ActionBar({ simCount }: { simCount: number | null }) { - const { t } = useTranslation(); +export function ActionBar({simCount}: {simCount: number | null}) { + const {t} = useTranslation(); return ( -
+
- {t("db.showing_simulations", { i: simCount ?? 0 })} + {t('db.showing_simulations', {i: simCount ?? 0})}
{/* */}
diff --git a/ui/packages/db/src/SharedComponents/ListView.tsx b/ui/packages/db/src/SharedComponents/ListView.tsx index c8ef37df5d..2d310422a6 100644 --- a/ui/packages/db/src/SharedComponents/ListView.tsx +++ b/ui/packages/db/src/SharedComponents/ListView.tsx @@ -1,9 +1,9 @@ -import { Spinner } from "@blueprintjs/core"; -import { Button, DBCard, Toaster, useToast } from "@gcsim/components"; -import { db } from "@gcsim/types"; +import {Spinner} from '@blueprintjs/core'; +import {Button, DBCard, Toaster, useToast} from '@gcsim/components'; +import {db} from '@gcsim/types'; -export function ListView({ data }: { data: db.Entry[] }) { - const { toast } = useToast(); +export function ListView({data}: {data: db.Entry[]}) { + const {toast} = useToast(); if (!data) { return (
@@ -13,16 +13,16 @@ export function ListView({ data }: { data: db.Entry[] }) { } const copyConfig = (cfg: string) => { - if (cfg === "") { + if (cfg === '') { toast({ - title: "Failed", - description: "Copied failed unexpected, no config found.", + title: 'Failed', + description: 'Copied failed unexpected, no config found.', }); } navigator.clipboard.writeText(cfg).then(() => { - console.log("copy ok"); + console.log('copy ok'); toast({ - title: "Copied to clipboard", + title: 'Copied to clipboard', description: `Copied config to clipboard`, }); }); @@ -36,22 +36,20 @@ export function ListView({ data }: { data: db.Entry[] }) { + rel="noopener noreferrer">
diff --git a/ui/packages/db/src/SharedComponents/Warning.tsx b/ui/packages/db/src/SharedComponents/Warning.tsx index 84c107a63c..0cc93a02e9 100644 --- a/ui/packages/db/src/SharedComponents/Warning.tsx +++ b/ui/packages/db/src/SharedComponents/Warning.tsx @@ -1,29 +1,28 @@ -import { Button } from "@blueprintjs/core"; -import tanuki from "images/tanuki.png"; -import React from "react"; -import { Trans, useTranslation } from "react-i18next"; +import {Button} from '@blueprintjs/core'; +import tanuki from 'images/tanuki.png'; +import React from 'react'; +import {Trans, useTranslation} from 'react-i18next'; export function Warning() { - const { t } = useTranslation(); + const {t} = useTranslation(); const [hide, setHide] = React.useState((): boolean => { - return localStorage.getItem("hide-warning") === "true"; + return localStorage.getItem('hide-warning') === 'true'; }); React.useEffect(() => { - localStorage.setItem("hide-warning", hide.toString()); + localStorage.setItem('hide-warning', hide.toString()); }, [hide]); if (hide) { return ( -
+
@@ -31,7 +30,7 @@ export function Warning() { } return ( -
+

-

{{ rerun: t("viewer.rerun") }}

+

{{rerun: t('viewer.rerun')}}

diff --git a/ui/packages/types/package.json b/ui/packages/types/package.json index a1f0dd5a4b..a43d10b5c2 100644 --- a/ui/packages/types/package.json +++ b/ui/packages/types/package.json @@ -3,6 +3,11 @@ "main": "src/index.ts", "packageManager": "yarn@3.2.4", "private": true, + "scripts": { + "gen:ts": "pbjs --keep-case -t static-module -w es6 --no-create --no-encode --no-decode --no-verify --no-convert --no-service ../../../protos/**/**/*.proto | pbts -o src/protos.d.ts - && echo \"generated ts protos successfully!\"", + "gen:go": "cd ../../../ && go generate && echo \"generated go protos successfully!\"", + "watch": "watch \"yarn run gen:ts && yarn run gen:go\" ../../../protos/model" + }, "devDependencies": { "protobufjs-cli": "^1.1.1" }, diff --git a/ui/packages/ui/src/Components/ConfigEditor/ConfigEditor.tsx b/ui/packages/ui/src/Components/ConfigEditor/ConfigEditor.tsx index 8fed66e3a4..45e57c9904 100644 --- a/ui/packages/ui/src/Components/ConfigEditor/ConfigEditor.tsx +++ b/ui/packages/ui/src/Components/ConfigEditor/ConfigEditor.tsx @@ -1,35 +1,35 @@ -import AceEditor from "react-ace"; +import AceEditor from 'react-ace'; //THESE IMPORTS NEEDS TO BE AFTER IMPORTING AceEditor -import "ace-builds/src-noconflict/ext-language_tools"; -import "../../util/mode-gcsim.js"; +import 'ace-builds/src-noconflict/ext-language_tools'; +import '../../util/mode-gcsim.js'; //manually import supported themes cause we can't get for loop to work here -import { FormGroup, HTMLSelect, NumericInput } from "@blueprintjs/core"; -import "ace-builds/src-noconflict/theme-github"; -import "ace-builds/src-noconflict/theme-kuroir"; -import "ace-builds/src-noconflict/theme-monokai"; -import "ace-builds/src-noconflict/theme-solarized_dark"; -import "ace-builds/src-noconflict/theme-solarized_light"; -import "ace-builds/src-noconflict/theme-terminal"; -import "ace-builds/src-noconflict/theme-textmate"; -import "ace-builds/src-noconflict/theme-tomorrow"; -import "ace-builds/src-noconflict/theme-tomorrow_night"; -import "ace-builds/src-noconflict/theme-twilight"; -import "ace-builds/src-noconflict/theme-xcode"; -import React from "react"; -import { useTranslation } from "react-i18next"; +import {FormGroup, HTMLSelect, NumericInput} from '@blueprintjs/core'; +import 'ace-builds/src-noconflict/theme-github'; +import 'ace-builds/src-noconflict/theme-kuroir'; +import 'ace-builds/src-noconflict/theme-monokai'; +import 'ace-builds/src-noconflict/theme-solarized_dark'; +import 'ace-builds/src-noconflict/theme-solarized_light'; +import 'ace-builds/src-noconflict/theme-terminal'; +import 'ace-builds/src-noconflict/theme-textmate'; +import 'ace-builds/src-noconflict/theme-tomorrow'; +import 'ace-builds/src-noconflict/theme-tomorrow_night'; +import 'ace-builds/src-noconflict/theme-twilight'; +import 'ace-builds/src-noconflict/theme-xcode'; +import React from 'react'; +import {useTranslation} from 'react-i18next'; export const themes = [ - "monokai", - "github", - "tomorrow", - "tomorrow_night", - "kuroir", - "twilight", - "xcode", - "textmate", - "solarized_dark", - "solarized_light", - "terminal", + 'monokai', + 'github', + 'tomorrow', + 'tomorrow_night', + 'kuroir', + 'twilight', + 'xcode', + 'textmate', + 'solarized_dark', + 'solarized_light', + 'terminal', ]; export type Theme = (typeof themes)[number]; @@ -39,13 +39,13 @@ type Props = { hideThemeSelector?: boolean; }; -const LOCALSTORAGE_THEME_KEY = "gcsim-config-editor-theme"; -const LOCALSTORAGE_FONT_SIZE_KEY = "gcsim-config-editor-font-size"; +const LOCALSTORAGE_THEME_KEY = 'gcsim-config-editor-theme'; +const LOCALSTORAGE_FONT_SIZE_KEY = 'gcsim-config-editor-font-size'; export function ConfigEditor(props: Props) { - const { t } = useTranslation(); + const {t} = useTranslation(); const [theme, setTheme] = React.useState(() => { - return localStorage.getItem(LOCALSTORAGE_THEME_KEY) ?? "tomorrow_night"; + return localStorage.getItem(LOCALSTORAGE_THEME_KEY) ?? 'tomorrow_night'; }); const [fontSize, setFontSize] = React.useState(() => { return localStorage.getItem(LOCALSTORAGE_FONT_SIZE_KEY) @@ -61,17 +61,16 @@ export function ConfigEditor(props: Props) {
{hideThemeSelector ? null : (
- ("simple.editor_theme")} inline> - setTheme(e.currentTarget.value)} - value={theme} - > + ('simple.editor_theme')} inline> + setTheme(e.currentTarget.value)}> {themes.map((t) => ( - + ))} - ("simple.font_size")} inline> + ('simple.font_size')} inline> setFontSize(e)} diff --git a/ui/packages/web/index.html b/ui/packages/web/index.html index 04fd154fc1..e99dbc42d8 100644 --- a/ui/packages/web/index.html +++ b/ui/packages/web/index.html @@ -4,22 +4,19 @@ + gcsim - simulation impact - + -
- + \ No newline at end of file diff --git a/ui/packages/web/public/ads.txt b/ui/packages/web/public/ads.txt deleted file mode 100644 index 949751e87e..0000000000 --- a/ui/packages/web/public/ads.txt +++ /dev/null @@ -1 +0,0 @@ -google.com, pub-9129749839418344, DIRECT, f08c47fec0942fa0 \ No newline at end of file diff --git a/ui/yarn.lock b/ui/yarn.lock index 1699f41bf5..69773babfc 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -3123,7 +3123,6 @@ __metadata: prettier-plugin-organize-imports: ^3.2.2 react: ^18.2.0 react-dom: ^18.2.0 - react-helmet-async: ^2.0.4 react-i18next: ^12.0.0 react-icons: ^4.6.0 react-infinite-scroll-component: ^6.1.0 @@ -21308,14 +21307,21 @@ __metadata: languageName: node linkType: hard -"react-fast-compare@npm:^3.0.1, react-fast-compare@npm:^3.1.1, react-fast-compare@npm:^3.2.0, react-fast-compare@npm:^3.2.2": +"react-fast-compare@npm:^3.0.1, react-fast-compare@npm:^3.1.1": + version: 3.2.0 + resolution: "react-fast-compare@npm:3.2.0" + checksum: 8ef272c825ae329f61633ce4ce7f15aa5b84e5214d88bc0823880236e03e985a13195befa2c7a4eda7db3b017dc7985729152d88445823f652403cf36c2b86aa + languageName: node + linkType: hard + +"react-fast-compare@npm:^3.2.0, react-fast-compare@npm:^3.2.2": version: 3.2.2 resolution: "react-fast-compare@npm:3.2.2" checksum: 2071415b4f76a3e6b55c84611c4d24dcb12ffc85811a2840b5a3f1ff2d1a99be1020d9437ee7c6e024c9f4cbb84ceb35e48cf84f28fcb00265ad2dfdd3947704 languageName: node linkType: hard -"react-helmet-async@npm:*, react-helmet-async@npm:^2.0.4": +"react-helmet-async@npm:*": version: 2.0.4 resolution: "react-helmet-async@npm:2.0.4" dependencies: