Skip to content

Commit

Permalink
Merge pull request #1325 from unleashurgeek/main_ui_fixes
Browse files Browse the repository at this point in the history
Various main UI minor changes
  • Loading branch information
unleashurgeek authored Apr 9, 2023
2 parents d37442d + cd58b23 commit 1e0447f
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 23 deletions.
4 changes: 3 additions & 1 deletion app/.proxyrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"/api": {
"target": "http://localhost:3030"
"target": "https://gcsim.app",
"changeOrigin": true,
"autoRewrite": true
}
}
3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"start": "parcel src/index.html",
"enka": "node ./src/Components/Enka/GenshinData/DownloadFromEnkaScript.js",
"names": "node ./scripts/portrait-link.js",
"build": "yarn enka && parcel build src/index.html --dist-dir build"
},
"devDependencies": {
Expand All @@ -26,7 +27,7 @@
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"genshin-db": "^4.3.5",
"genshin-db": "*",
"parcel-reporter-static-files-copy": "^1.3.4",
"parcel-resolver-ignore": "^2.0.0",
"postcss": "^8.3.11",
Expand Down
26 changes: 25 additions & 1 deletion app/public/locales/IngameNames.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
"wanderer": "Wanderer",
"alhaitham": "Alhaitham",
"yaoyao": "Yaoyao",
"mika": "Mika",
"dehya": "Dehya",
"travelerelectro": "Traveler (Electro)",
"traveleranemo": "Traveler (Anemo)",
"travelergeo": "Traveler (Geo)",
Expand All @@ -121,6 +123,7 @@
"aquasimulacra": "Aqua Simulacra",
"aquilafavonia": "Aquila Favonia",
"athousandfloatingdreams": "A Thousand Floating Dreams",
"beaconofthereedsea": "Beacon of the Reed Sea",
"beginnersprotector": "Beginner's Protector",
"blackcliffagate": "Blackcliff Agate",
"blackclifflongsword": "Blackcliff Longsword",
Expand Down Expand Up @@ -182,6 +185,7 @@
"lostprayertothesacredwinds": "Lost Prayer to the Sacred Winds",
"luxurioussealord": "Luxurious Sea-Lord",
"magicguide": "Magic Guide",
"mailedflower": "Mailed Flower",
"makhairaaquamarine": "Makhaira Aquamarine",
"mappamare": "Mappa Mare",
"memoryofdust": "Memory of Dust",
Expand Down Expand Up @@ -375,6 +379,8 @@
"wanderer": "流浪者",
"alhaitham": "艾尔海森",
"yaoyao": "瑶瑶",
"mika": "米卡",
"dehya": "迪希雅",
"travelerelectro": "旅行者 (雷元素)",
"traveleranemo": "旅行者 (风元素)",
"travelergeo": "旅行者 (岩元素)",
Expand All @@ -389,6 +395,7 @@
"aquasimulacra": "若水",
"aquilafavonia": "风鹰剑",
"athousandfloatingdreams": "千夜浮梦",
"beaconofthereedsea": "苇海信标",
"beginnersprotector": "新手长枪",
"blackcliffagate": "黑岩绯玉",
"blackclifflongsword": "黑岩长剑",
Expand Down Expand Up @@ -450,6 +457,7 @@
"lostprayertothesacredwinds": "四风原典",
"luxurioussealord": "衔珠海皇",
"magicguide": "魔导绪论",
"mailedflower": "饰铁之花",
"makhairaaquamarine": "玛海菈的水色",
"mappamare": "万国诸海图谱",
"memoryofdust": "尘世之锁",
Expand Down Expand Up @@ -643,6 +651,8 @@
"wanderer": "放浪者",
"alhaitham": "アルハイゼン",
"yaoyao": "ヨォーヨ",
"mika": "ミカ",
"dehya": "ディシア",
"travelerelectro": "旅人 (雷元素)",
"traveleranemo": "旅人 (風元素)",
"travelergeo": "旅人 (岩元素)",
Expand All @@ -657,6 +667,7 @@
"aquasimulacra": "若水",
"aquilafavonia": "風鷹剣",
"athousandfloatingdreams": "千夜に浮かぶ夢",
"beaconofthereedsea": "葦海の標",
"beginnersprotector": "新米の長槍",
"blackcliffagate": "黒岩の緋玉",
"blackclifflongsword": "黒岩の長剣",
Expand Down Expand Up @@ -718,6 +729,7 @@
"lostprayertothesacredwinds": "四風原典",
"luxurioussealord": "銜玉の海皇",
"magicguide": "魔導緒論",
"mailedflower": "鉄彩の花",
"makhairaaquamarine": "マカイラの水色",
"mappamare": "万国諸海の図譜",
"memoryofdust": "浮世の錠",
Expand Down Expand Up @@ -911,6 +923,8 @@
"wanderer": "Trotamundos",
"alhaitham": "Alhacén",
"yaoyao": "Yaoyao",
"mika": "Mika",
"dehya": "Dehya",
"travelerelectro": "Viajera (Electro)",
"traveleranemo": "Viajera (Anemo)",
"travelergeo": "Viajera (Geo)",
Expand All @@ -925,6 +939,7 @@
"aquasimulacra": "Aqua Simulacra",
"aquilafavonia": "Aquila Favonia",
"athousandfloatingdreams": "Sueños de las Mil Noches",
"beaconofthereedsea": "Emblema del Mar de Juncos",
"beginnersprotector": "Lanza del Principiante",
"blackcliffagate": "Ágata del Peñasco Oscuro",
"blackclifflongsword": "Espada Larga del Peñasco Oscuro",
Expand Down Expand Up @@ -986,6 +1001,7 @@
"lostprayertothesacredwinds": "Oración Perdida a los Vientos Sagrados",
"luxurioussealord": "Rey de los Mares",
"magicguide": "Guía Mágica",
"mailedflower": "Fierro Floriorlado",
"makhairaaquamarine": "Májaira Aguamarina",
"mappamare": "Carta Náutica",
"memoryofdust": "Candado Terrenal",
Expand Down Expand Up @@ -1179,6 +1195,8 @@
"wanderer": "Странник",
"alhaitham": "Аль-Хайтам",
"yaoyao": "Яо Яо",
"mika": "Мика",
"dehya": "Дэхья",
"travelerelectro": "Путешественница (Электро)",
"traveleranemo": "Путешественница (Анемо)",
"travelergeo": "Путешественница (Гео)",
Expand All @@ -1193,6 +1211,7 @@
"aquasimulacra": "Аква симулякрум",
"aquilafavonia": "Меч Сокола",
"athousandfloatingdreams": "Сновидения тысячи ночей",
"beaconofthereedsea": "Маяк тростникового моря",
"beginnersprotector": "Копьё новичка",
"blackcliffagate": "Черногорский агат",
"blackclifflongsword": "Черногорский длинный меч",
Expand Down Expand Up @@ -1254,6 +1273,7 @@
"lostprayertothesacredwinds": "Молитва святым ветрам",
"luxurioussealord": "Благодатный владыка вод",
"magicguide": "Руководство по магии",
"mailedflower": "Цветок в латах",
"makhairaaquamarine": "Аквамарин Махайры",
"mappamare": "Морской атлас",
"memoryofdust": "Память о пыли",
Expand Down Expand Up @@ -1447,6 +1467,8 @@
"wanderer": "Wanderer",
"alhaitham": "Alhaitham",
"yaoyao": "Yaoyao",
"mika": "Mika",
"dehya": "Dehya",
"travelerelectro": "Reisende (Elektro)",
"traveleranemo": "Reisende (Anemo)",
"travelergeo": "Reisende (Geo)",
Expand All @@ -1461,6 +1483,7 @@
"aquasimulacra": "Aqua Simulacra",
"aquilafavonia": "Windfalke",
"athousandfloatingdreams": "Fließende Träume von tausend Nächten",
"beaconofthereedsea": "Schilfmeer-Bake",
"beginnersprotector": "Anfängerlanze",
"blackcliffagate": "Schwarzstein-Achat",
"blackclifflongsword": "Schwarzstein-Langschwert",
Expand Down Expand Up @@ -1522,6 +1545,7 @@
"lostprayertothesacredwinds": "Gebete der Vier Winde",
"luxurioussealord": "Luxuriöser Seekönig",
"magicguide": "Magieführer",
"mailedflower": "Eiserne Blume",
"makhairaaquamarine": "Makhaira-Aquamarin",
"mappamare": "Illustrationen von Landen und Wassern",
"memoryofdust": "Ketten des Diesseits",
Expand Down Expand Up @@ -1607,4 +1631,4 @@
"xiphosmoonlight": "Mondlicht von Xiphos"
}
}
}
}
8 changes: 5 additions & 3 deletions app/scripts/portrait-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ const names = [
"faruzan",
"wanderer",
"alhaitham",
"yaoyao"
"yaoyao",
"mika",
"dehya"
];

const travelers = [
Expand Down Expand Up @@ -298,12 +300,12 @@ sets.forEach((e) => {

fs.writeFileSync(
"./src/Components/data/artifactNames.json",
JSON.stringify(setMap),
JSON.stringify(setMap, null, 2),
"utf-8"
);

fs.writeFileSync(
"./public/locales/IngameNames.json",
JSON.stringify(trans),
JSON.stringify(trans, null, 2),
"utf-8"
);
73 changes: 73 additions & 0 deletions app/src/Components/Banners.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { Callout } from "@blueprintjs/core";
import { useTranslation } from "react-i18next";
//@ts-ignore
import DiscordLogo from "./Footer/discord-icon.svg";
import { SimResults } from "./Viewer/DataType";


export const AnnouncementBanner = ({}) => {
const { t } = useTranslation();

const link = (
<a href="https://discord.gg/m7jvjdxx7q" target="_blank">
<img
src={DiscordLogo}
alt="Discord Logo"
className="inline object-contain h-[18px]"
/>
{' '} discord
</a>
);

const title = t("game:character_names.dehya") + " and " + t("game:character_names.mika") + " now available!"

return (
<Callout intent="primary" title={title} className="mt-4">
<div>
Visit the {link} for detailed release notes
</div>
</Callout>
);
}

export const EarlyReleaseBanner = ({ data }: { data: SimResults }) => {
const { t } = useTranslation();

if (data.incomplete_chars == null || data.incomplete_chars.length == 0) {
return null;
}

const link = (
<a href="https://discord.gg/m7jvjdxx7q" target="_blank">
<img
src={DiscordLogo}
alt="Discord Logo"
className="inline object-contain h-[18px]"
/>
{' '} gcsim discord!
</a>
);

return (
<div className="flex flex-col items-center">
<Callout intent="warning" title="Early Release Characters" className="mb-4 max-w-2xl">
<p>
This simulation contains early release characters! These characters are fully implemented,
but may not have optimal frame data aligned with in-game animations. We are actively
collecting data to improve their implementation. If you wish to help,
please reach out in the {link}
</p>
<div className="flex flex-col justify-start gap-1 text-xs font-mono text-gray-400">
<span className="font-bold text-sm font-sans ">
DB submissions for these characters will be disabled until frames are updated:
</span>
<ul className="list-disc pl-4 grid grid-cols-1 gap-x-3 justify-start">
{data.incomplete_chars?.map((c) => (
<div className="list-item">{t('game:character_names.' + c)}</div>
))}
</ul>
</div>
</Callout>
</div>
);
}
1 change: 1 addition & 0 deletions app/src/Components/Viewer/DataType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface SimResults {
num_targets: number;
//character details
char_details: CharDetail[];
incomplete_chars?: string[];
}

export interface CharDetail {
Expand Down
2 changes: 2 additions & 0 deletions app/src/Components/Viewer/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
SimplePreset,
VerbosePreset,
} from "./debugOptions";
import { EarlyReleaseBanner } from "../Banners";

type ViewProps = {
classes?: string;
Expand Down Expand Up @@ -126,6 +127,7 @@ function ViewOnly(props: ViewProps) {
<div
className={props.classes + " p-4 rounded-lg bg-gray-800 flex flex-col"}
>
<EarlyReleaseBanner data={props.data} />
<div className="flex flex-row bg-gray-800 ">
<Tabs
selectedTabId={tabID}
Expand Down
15 changes: 2 additions & 13 deletions app/src/Pages/Dash/Dash.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Callout, Card, Elevation, H3, Icon } from '@blueprintjs/core';
import { Link } from 'wouter';
import { Trans, useTranslation } from 'react-i18next';
import { AnnouncementBanner } from '~src/Components/Banners';

interface DashCardProps {
children: React.ReactNode;
Expand Down Expand Up @@ -42,19 +43,7 @@ export function Dash() {
useTranslation();
return (
<main className="w-full flex flex-col items-center flex-grow ">
<span>
<Callout intent="success" className=" max-w-[600px] mt-4">
Thank you for your patience. The core rewrite is now complete. Hitlag
has been implemented along with a ton of config syntax improvements.
<br />
<div className="mt-2 font-bold">
Please check out the migration guide here:{' '}
<a href="https://docs.gcsim.app/migration" target="_blank">
Migration Guide
</a>
</div>
</Callout>
</span>
<span><AnnouncementBanner /></span>
<div className="flex flex-row flex-initial flex-wrap w-full lg:w-[60rem] mt-4">
<DashCard href="/simulator">
<span className="font-bold text-xl">
Expand Down
8 changes: 4 additions & 4 deletions app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2489,10 +2489,10 @@ fuzzysort@^1.1.4:
resolved "https://registry.yarnpkg.com/fuzzysort/-/fuzzysort-1.9.0.tgz#d36d27949eae22340bb6f7ba30ea6751b92a181c"
integrity sha512-MOxCT0qLTwLqmEwc7UtU045RKef7mc8Qz8eR4r2bLNEq9dy/c3ZKMEFp6IEst69otkQdFZ4FfgH2dmZD+ddX1g==

genshin-db@^4.3.5:
version "4.3.5"
resolved "https://registry.yarnpkg.com/genshin-db/-/genshin-db-4.3.5.tgz#7c664944bcd72c623f7582ffe35a4efbd253c7f9"
integrity sha512-EjabM/fxFs+TQ2exsDfRmnMab4dLYUJzSoRZsJ2Jee1ajVUnyNAbpDvPAIuQwIXZXEXmSB6U0xLnKMZlsyX05g==
genshin-db@*:
version "4.3.6"
resolved "https://registry.yarnpkg.com/genshin-db/-/genshin-db-4.3.6.tgz#7eba5f2769357e3ee19815a3effea70a7a61a112"
integrity sha512-Zym0yhIlSkOdhIfl4CLe+HiyPehMsium9bWfZr2gq7sOVL9KAJrR0MtsrrxAj1PFfnzS6S44YOPyf/eeQKoPhA==
dependencies:
fuzzysort "^1.1.4"
pako "^2.0.4"
Expand Down
19 changes: 19 additions & 0 deletions pkg/result/check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package result

import (
"github.com/genshinsim/gcsim/pkg/core/keys"
)

// adding a character to this list will make the "incomplete warning" appear on the viewer
var incompleteCharacters = []keys.Char{
keys.TestCharDoNotUse,
}

func IsCharacterComplete(char keys.Char) bool {
for _, v := range incompleteCharacters {
if v == char {
return false
}
}
return true
}
5 changes: 5 additions & 0 deletions pkg/result/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Summary struct {
ReactionsTriggered map[string]agg.IntStat `json:"reactions_triggered"`
ElementUptime []map[string]agg.IntStat `json:"ele_uptime"`
RequiredER []float64 `json:"required_er"`
IncompleteChars []string `json:"incomplete_chars"`

Duration agg.FloatStat `json:"sim_duration"`
//final result
Expand Down Expand Up @@ -61,6 +62,10 @@ type Summary struct {
func (r *Summary) Map(cfg *ast.ActionList, result *agg.Result) {
for _, v := range cfg.Characters {
r.CharNames = append(r.CharNames, v.Base.Key.String())

if !IsCharacterComplete(v.Base.Key) {
r.IncompleteChars = append(r.IncompleteChars, v.Base.Key.String())
}
}

// metadata agg
Expand Down

0 comments on commit 1e0447f

Please sign in to comment.