Skip to content

Commit

Permalink
revert ads (#2187)
Browse files Browse the repository at this point in the history
  • Loading branch information
srliao authored Jun 24, 2024
1 parent f62eddb commit 62aef0b
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 97 deletions.
9 changes: 2 additions & 7 deletions ui/packages/db/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@
<meta
name="description"
content="gcsim - a team dps simulator for Genshin Impact" />
<meta name="google-adsense-account" content="ca-pub-9129749839418344" />
<title>gcsim - simulation impact</title>
<link rel="shortcut icon" href="/images/favicon.ico" />
<link rel="shortcut icon" href="/images/favicon.ico">

<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet" />
<script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9129749839418344"
crossorigin="anonymous"></script>
</head>
<body style="scrollbar-gutter: stable" class="bp4-dark">
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
</html>
1 change: 0 additions & 1 deletion ui/packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion ui/packages/db/public/ads.txt

This file was deleted.

2 changes: 1 addition & 1 deletion ui/packages/db/src/Pages/Database/DBVIew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Props = {
export const DBView = (props: Props) => {
const {t} = useTranslation();
return (
<div className="flex flex-col gap-4 m-8 my-4 items-center min-[1300px]:mx-[160px]">
<div className="flex flex-col gap-4 m-8 my-4 items-center">
<ActionBar simCount={props.data.length} />
<Warning />
{props.data.length === 0 ? (
Expand Down
14 changes: 7 additions & 7 deletions ui/packages/db/src/SharedComponents/ActionBar.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="flex flex-row justify-between items-center w-full max-w-[970px] min-[1300px]:w-[970px] gap-4">
<div className="flex flex-row justify-between items-center w-full max-w-7xl gap-4">
<Filter />
<CharacterQuickSelect />

<div className="text-base hidden md:block md:text-2xl">
{t<string>("db.showing_simulations", { i: simCount ?? 0 })}
{t('db.showing_simulations', {i: simCount ?? 0})}
</div>
{/* <Sorter /> */}
</div>
Expand Down
32 changes: 15 additions & 17 deletions ui/packages/db/src/SharedComponents/ListView.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
Expand All @@ -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`,
});
});
Expand All @@ -36,22 +36,20 @@ export function ListView({ data }: { data: db.Entry[] }) {
<DBCard
entry={entry}
key={index}
className="min-[1300px]:w-[970px] border-0 w-full max-w-[970px]"
className="min-[1300px]:w-[1100px] border-0"
footer={
<div className="flex flex-row flex-wrap place-content-end mr-2 gap-4">
<Button
className="bg-emerald-600"
onClick={() => {
copyConfig(entry.config ?? "");
}}
>
copyConfig(entry.config ?? '');
}}>
Copy Config
</Button>
<a
href={"https://gcsim.app/db/" + entry._id}
href={'https://gcsim.app/db/' + entry._id}
target="_blank"
rel="noopener noreferrer"
>
rel="noopener noreferrer">
<Button className="bg-blue-600">Open in Viewer</Button>
</a>
</div>
Expand Down
27 changes: 13 additions & 14 deletions ui/packages/db/src/SharedComponents/Warning.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
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>((): 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 (
<div className="flex flex-col py-0 min-[1300px]:w-[970px]">
<div className="flex flex-col py-0 min-[1300px]:w-[1100px]">
<div className="ml-auto">
<Button
small
intent="success"
onClick={() => {
setHide(false);
}}
>
{t<string>("db.readme_show")}
}}>
{t('db.readme_show')}
</Button>
</div>
</div>
);
}

return (
<div className="relative flex flex-col gap-2 items-center bg-slate-900 px-5 py-0 border border-blue-800 min-[1300px]:w-[970px] max-w-[970px]">
<div className="relative flex flex-col gap-2 items-center bg-slate-900 px-5 py-0 border border-blue-800 min-[1300px]:w-[1100px]">
<div className="absolute top-1 right-1">
<Button
icon="cross"
Expand All @@ -45,14 +44,14 @@ export function Warning() {
<div className="inline-flex pt-4">
<img src={tanuki} className="w-15 h-10 mx-0" />
<div className="font-semibold px-3 pt-2 text-xl w-50 text-gray-200">
{t<string>("db.readme_header")}
{t('db.readme_header')}
</div>
<img src={tanuki} className="w-15 h-10 mx-0" />
</div>
<div className="space-y-3 pb-3 text-s leading-5 text-gray-400">
<Trans i18nKey="db.readme_body">
<p />
<p>{{ rerun: t<string>("viewer.rerun") }}</p>
<p>{{rerun: t('viewer.rerun')}}</p>
<p className="font-semibold leading-6 text-gray-200" />
</Trans>
</div>
Expand Down
5 changes: 5 additions & 0 deletions ui/packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
77 changes: 38 additions & 39 deletions ui/packages/ui/src/Components/ConfigEditor/ConfigEditor.tsx
Original file line number Diff line number Diff line change
@@ -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];

Expand All @@ -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<Theme>(() => {
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)
Expand All @@ -61,17 +61,16 @@ export function ConfigEditor(props: Props) {
<div className="p-1 md:p-2">
{hideThemeSelector ? null : (
<div className="my-1 w-full flex flex-col gap-0.5 items-center md:flex-row-reverse md:gap-4 md:items-start">
<FormGroup label={t<string>("simple.editor_theme")} inline>
<HTMLSelect
onChange={(e) => setTheme(e.currentTarget.value)}
value={theme}
>
<FormGroup label={t<string>('simple.editor_theme')} inline>
<HTMLSelect onChange={(e) => setTheme(e.currentTarget.value)}>
{themes.map((t) => (
<option key={t}>{t}</option>
<option key={t} selected={t == theme}>
{t}
</option>
))}
</HTMLSelect>
</FormGroup>
<FormGroup label={t<string>("simple.font_size")} inline>
<FormGroup label={t<string>('simple.font_size')} inline>
<NumericInput
defaultValue={fontSize}
onValueChange={(e) => setFontSize(e)}
Expand Down
9 changes: 3 additions & 6 deletions ui/packages/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self' *.cloudflareinsights.com;" />
<meta
name="description"
content="gcsim - a team dps simulator for Genshin Impact" />
<title>gcsim - simulation impact</title>
<link rel="shortcut icon" href="/images/favicon.ico" />
<link rel="shortcut icon" href="/images/favicon.ico">

<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet" />
<script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9129749839418344"
crossorigin="anonymous"></script>
</head>
<body style="scrollbar-gutter: stable" class="bp4-dark">
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
</html>
1 change: 0 additions & 1 deletion ui/packages/web/public/ads.txt

This file was deleted.

12 changes: 9 additions & 3 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 62aef0b

Please sign in to comment.