Skip to content

Commit

Permalink
fix a lot of lint and oopsies
Browse files Browse the repository at this point in the history
  • Loading branch information
WxWatch committed Jun 23, 2024
1 parent 3bd1cfb commit 8e4e924
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 386 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wxwatch/gacha-tracker",
"version": "1.3.0",
"version": "1.4.0-2",
"description": "An unofficial tool for managing and analyzing your miHoYo gacha records",
"homepage": "https://github.com/WxWatch/gacha-tracker",
"repository": "https://github.com/WxWatch/gacha-tracker.git",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gacha_tracker"
version = "1.3.0"
version = "1.4.0-2"
edition = "2021"
authors = ["WxWatch"]
description = "An unofficial tool for managing and analyzing your miHoYo gacha records"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "gacha_tracker",
"version": "1.3.0"
"version": "1.4.0-2"
},
"tauri": {
"allowlist": {
Expand Down
3 changes: 0 additions & 3 deletions src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import React from "react";
import Stack from "@mui/material/Stack";
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
import Typography from "@mui/material/Typography";

export interface LayoutProps {}

Expand Down
7 changes: 1 addition & 6 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from "react";
import { styled, useTheme, Theme, CSSObject } from "@mui/material/styles";
import Box from "@mui/material/Box";
import MuiDrawer from "@mui/material/Drawer";
import MuiAppBar, { AppBarProps as MuiAppBarProps } from "@mui/material/AppBar";
import List from "@mui/material/List";
import CssBaseline from "@mui/material/CssBaseline";
import Divider from "@mui/material/Divider";
Expand Down Expand Up @@ -89,10 +88,6 @@ const DrawerHeader = styled("div")(({ theme }) => ({
...theme.mixins.toolbar,
}));

interface AppBarProps extends MuiAppBarProps {
open?: boolean;
}

const Drawer = styled(MuiDrawer, {
shouldForwardProp: (prop) => prop !== "open",
})(({ theme, open }) => ({
Expand Down Expand Up @@ -152,7 +147,7 @@ export default function Sidebar() {
</DrawerHeader>
<Divider />
<List>
{[...Navs, NavSetting].map((nav, index) => (
{[...Navs, NavSetting].map((nav) => (
<ListItem key={nav.title} disablePadding sx={{ display: "block" }}>
<Tooltip title={nav.title} placement="right">
<ListItemButton
Expand Down
1 change: 1 addition & 0 deletions src/components/account/AccountMenuDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ function AccountMenuDialogForm(props: AccountMenuDialogFormProps) {
const FacetGameDataDirExamples: Record<AccountFacet, string> = {
[AccountFacet.Genshin]: "D:/Genshin Impact/Genshin Impact Game/YuanShen_Data",
[AccountFacet.StarRail]: "D:/StarRail/Game/StarRail_Data",
[AccountFacet.WutheringWaves]: "D:/Wuthering Waves/Wuthering Waves Game/",
};

function numericOnly(evt: React.KeyboardEvent<HTMLElement>) {
Expand Down
3 changes: 0 additions & 3 deletions src/components/gacha/GachaItemView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ export function MihoyoItemView({
facet: AccountFacet;
size?: number;
}) {
console.log("beepo", { item });

return (
<GachaItemViewInternal
facet={facet}
Expand All @@ -122,7 +120,6 @@ export function KuroItemView({
facet: AccountFacet;
size?: number;
}) {
console.log("beepo", { item });
return (
<GachaItemViewInternal
facet={facet}
Expand Down
1 change: 0 additions & 1 deletion src/components/gacha/chart/GachaChartPie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function GachaChartCalendar() {
} = useGachaLayoutContext();

const itemTypesData = aggregatedValues.values.reduce((acc, cur) => {
console.log("cur", cur);
const key = getItemType(facet, cur);
if (!acc[key]) {
acc[key] = 1;
Expand Down
73 changes: 1 addition & 72 deletions src/components/gacha/overview/kuro/GachaOverviewGridKuro.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React from "react";
import { AccountFacet, resolveCurrency } from "@/interfaces/account";
import { AccountFacet } from "@/interfaces/account";
import { useGachaLayoutContext } from "@/components/gacha/GachaLayoutContext";
import { SxProps, Theme } from "@mui/material/styles";
import Box from "@mui/material/Box";
import Card from "@mui/material/Card";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import Chip from "@mui/material/Chip";
import CardHeader from "@mui/material/CardHeader";
import CardContent from "@mui/material/CardContent";
import GachaItemView from "../../GachaItemView";
import Divider from "@mui/material/Divider";
import {
Expand Down Expand Up @@ -75,68 +72,6 @@ export default function GachaOverviewGridKuro() {
);
}

function GachaOverviewLast({
facet,
metadata,
}: {
facet: AccountFacet;
metadata: AdvancedKuroRecordsMetadata;
}) {
const last = metadata.values[metadata.values.length - 1];
const lastName = last ? last.name : "none";
return (
<Stack sx={{ gap: 1, flexBasis: "50%" }}>
<Card
sx={{
position: "relative",
textAlign: "center",
flexShrink: 1,
}}
>
<GachaItemView facet={facet} key={last.id} item={last} />

<Typography
variant="h6"
sx={{
position: "absolute",
bottom: 0,
left: 0,
right: 0,
bgcolor: "rgba(0, 0, 0, 0.5)",
color: "#efefef",
padding: "0 4px",
}}
>
{lastName}
</Typography>
<Typography
sx={{
position: "absolute",
top: 0,
right: 0,
background: "rgba(0, 0, 0, 0.5)",
color: "#efefef",
borderBottomLeftRadius: "8px",
padding: "0 8px",
}}
variant="caption"
>
{`Last ${last.qualityLevel}★`}
</Typography>
</Card>
<Statistic
title={`${last.qualityLevel}★ Rate`}
statistic={metadata.sumPercentage}
suffix="%"
/>
<Statistic
title={`Avg. wishes per ${last.qualityLevel}★`}
statistic={metadata.sumAverage}
/>
</Stack>
);
}

const GachaOverviewGridCardSx: SxProps<Theme> = {
gap: 2,
position: "relative",
Expand Down Expand Up @@ -197,7 +132,6 @@ function Statistic({
function GachaOverviewCard({
facet,
value,
newbie,
}: {
facet: AccountFacet;
value: NamedKuroRecords | KuroRecords["aggregatedValues"];
Expand All @@ -207,14 +141,9 @@ function GachaOverviewCard({
total,
metadata: { golden, purple },
} = value;
const { action } = resolveCurrency(facet);
const category = "category" in value ? value.category : "aggregated";
const categoryTitle =
"categoryTitle" in value ? value.categoryTitle : "Total";

const newbieGolden = newbie && newbie.metadata.golden.values[0];
const newbieGoldenName = newbieGolden && `${newbieGolden.name}`;

if (total === 0) {
return (
<Card sx={GachaOverviewGridCardSx}>
Expand Down
149 changes: 1 addition & 148 deletions src/components/gacha/overview/mihoyo/GachaOverviewGridMihoyo.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import React from "react";
import { AccountFacet, resolveCurrency } from "@/interfaces/account";
import { AccountFacet } from "@/interfaces/account";
import { useGachaLayoutContext } from "@/components/gacha/GachaLayoutContext";
import { SxProps, Theme } from "@mui/material/styles";
import Box from "@mui/material/Box";
import Card from "@mui/material/Card";
import Grid from "@mui/material/Grid";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import Chip from "@mui/material/Chip";
import CardHeader from "@mui/material/CardHeader";
import CardContent from "@mui/material/CardContent";
import Divider from "@mui/material/Divider";
import GachaItemView from "../../GachaItemView";
import {
Expand Down Expand Up @@ -70,143 +66,6 @@ export default function GachaOverviewGridMihoyo() {
);
}

function GachaOverviewLast({
facet,
metadata,
}: {
facet: AccountFacet;
metadata: AdvancedMihoyoRecordsMetadata;
}) {
const last = metadata.values[metadata.values.length - 1];
const lastName = last ? last.name : "none";
return (
<Stack sx={{ gap: 1, flexBasis: "50%" }}>
<Card
sx={{
position: "relative",
textAlign: "center",
flexShrink: 1,
}}
>
<GachaItemView facet={facet} item={last} key={last.id} />

<Typography
variant="h6"
sx={{
position: "absolute",
bottom: 0,
left: 0,
right: 0,
bgcolor: "rgba(0, 0, 0, 0.5)",
color: "#efefef",
padding: "0 4px",
}}
>
{lastName}
</Typography>
<Typography
sx={{
position: "absolute",
top: 0,
right: 0,
background: "rgba(0, 0, 0, 0.5)",
color: "#efefef",
borderBottomLeftRadius: "8px",
padding: "0 8px",
}}
variant="caption"
>
{`Last ${last.rank_type}★`}
</Typography>
</Card>
<Statistic
title={`${last.rank_type}★ Rate`}
statistic={metadata.sumPercentage}
suffix="%"
/>
<Statistic
title={`Avg. wishes per ${last.rank_type}★`}
statistic={metadata.sumAverage}
/>
</Stack>
);
}

function GachaOverviewGridCard({
facet,
value,
newbie,
}: {
facet: AccountFacet;
value: NamedMihoyoRecords | MihoyoRecords["aggregatedValues"];
newbie?: NamedMihoyoRecords;
}) {
const {
total,
metadata: { golden, purple },
} = value;
const { action } = resolveCurrency(facet);
const category = "category" in value ? value.category : "aggregated";
const categoryTitle =
"categoryTitle" in value ? value.categoryTitle : "Total";

const newbieGolden = newbie && newbie.metadata.golden.values[0];
const newbieGoldenName = newbieGolden && `${newbieGolden.name}`;

if (total === 0) {
return (
<Card sx={GachaOverviewGridCardSx}>
<Box className="category">
<Typography component="div" variant="body2">
{categoryTitle}
</Typography>
</Box>
<Box>
<Typography>No data available</Typography>
</Box>
</Card>
);
}

return (
<Card sx={GachaOverviewGridCardSx}>
<CardHeader
title={categoryTitle}
subheader={
<Stack direction="row" gap={1}>
<Chip
label={`Lifetime ${action.plural}: ${total}`}
color="primary"
/>
{category !== "aggregated" ? (
<Chip label={`5★ Pity: ${golden.nextPity}`} color="warning" />
) : (
newbieGoldenName && (
<Chip
label={`Novice 5★: ${newbieGoldenName}`}
color="warning"
/>
)
)}
<Chip label={`4★ Pity: ${purple.nextPity}`} color="secondary" />
</Stack>
}
></CardHeader>
<CardContent>
<Stack direction="row" justifyContent="space-around" sx={{ gap: 2 }}>
{golden.values.length === 0 || (
<GachaOverviewLast facet={facet} metadata={golden} />
)}

{purple.values.length === 0 || (
<GachaOverviewLast facet={facet} metadata={purple} />
)}
</Stack>
</CardContent>
</Card>
);
}

const GachaOverviewGridCardSx: SxProps<Theme> = {
gap: 2,
position: "relative",
Expand Down Expand Up @@ -267,7 +126,6 @@ function Statistic({
function GachaOverviewCard({
facet,
value,
newbie,
}: {
facet: AccountFacet;
value: NamedMihoyoRecords | MihoyoRecords["aggregatedValues"];
Expand All @@ -277,14 +135,9 @@ function GachaOverviewCard({
total,
metadata: { golden, purple },
} = value;
const { action } = resolveCurrency(facet);
const category = "category" in value ? value.category : "aggregated";
const categoryTitle =
"categoryTitle" in value ? value.categoryTitle : "Total";

const newbieGolden = newbie && newbie.metadata.golden.values[0];
const newbieGoldenName = newbieGolden && `${newbieGolden.name}`;

if (total === 0) {
return (
<Card sx={GachaOverviewGridCardSx}>
Expand Down
Loading

0 comments on commit 8e4e924

Please sign in to comment.