Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Luzefiru/wuwatracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Luzefiru committed Jun 5, 2024
2 parents 95bbd85 + 112ec7f commit a176e7d
Show file tree
Hide file tree
Showing 18 changed files with 257 additions and 68 deletions.
13 changes: 12 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ email, or any other method with the owners of this repository before making a ch

We use a simplified version of [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

- this also applies to PRs

## Versioning Conventions

We take inspiration from [Semantic Versioning 2.0.0](https://semver.org/).

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
2. Update the README.md with details of changes to the interface; this includes new environment variables, exposed ports, valid file locations and container parameters.
3. You may merge the Pull Request once you have the sign-off of the maintainers, or if you do not have permission to do that, you may request a maintainer to merge it for you.
3. Your Pull Request will be merged to the preview environment by the maintainers once it's approved after review.
4. Your changes won't reflect on the main website until enough testers have confirmed the preview environment to be stable and usable and when the maintainers create a new release.

- by default, any merge to the `main` branch is a patch
- when the commit message has a `#minor` string, it will be a minor release
- `#major` applies the same way

## Issue Report Process

Expand Down
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ _Smartphone (please complete the following information):_
## Additional Context

_Add any other context about the problem here._

<!-- If you want to contribute to the codebase, uncomment the section below and feel free to fork the repo and make a PR to close this issue. -->

<!-- ## Would I like to work on this? -->
<!-- Yes. -->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ A clear and concise description of any alternative solutions or features you've

_Additional context_
Add any other context or screenshots about the feature request here.

<!-- If you want to contribute to the codebase, uncomment the section below and feel free to fork the repo and make a PR to close this issue. -->

<!-- ## Would I like to work on this? -->
<!-- Yes. -->
4 changes: 4 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ We'd love your help in improving the website with features, bug reports, and pat
1. Read our [Contributing Guide](./CONTRIBUTING.md) before making an issue or pull request.
2. [Fork this repository](https://github.com/Luzefiru/wuwatracker/fork) and start working on your own repository before making a pull request.

#### Apply as a Tester

If you're interested in testing new features, head over to our [Discord Server](https://discord.gg/mADnEXwZGT) and read the pinned messages in the `#tester-application` text channel.

### For Feature Requests or Bug Reports

[Create an issue](https://github.com/Luzefiru/wuwatracker/issues/new/choose) while following the specific templates.
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Tagging Pipeline

on:
# on every push to main branch
push:
branches:
- main

jobs:
tag_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump version and push tag
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(join(github.event.commits.*.message, ' '), '#skip') != true}}
uses: anothrNick/github-tag-action@a2c70ae13a881faf2b4953baaa9e49731997ab36
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch
WITH_V: true
Binary file added public/icons/astrite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/icons/astrites.png
Binary file not shown.
Binary file added public/icons/lustrous-tide.webp
Binary file not shown.
Binary file added public/icons/radiant-tide.webp
Binary file not shown.
28 changes: 26 additions & 2 deletions src/app/(main-layout)/convene/[name]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"use client";

import { BannerTypeSlug, BannerTypeSlugEnum } from "@/types/BannerTypeSlugEnum";
import { Sidebar } from "@/components/ui/sidebar";
import { BannerStatsCard } from "@/components/convenes/banner-stats-card";
import { bannerMetadata } from "@/data/banners";
import { notFound } from "next/navigation";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import { usePullHistory } from "@/contexts/pullHistoryContext";
import { Import } from "lucide-react";
import Link from "next/link";

export default function Page({
params,
Expand All @@ -16,6 +19,24 @@ export default function Page({
notFound();
}

const {
limitedCharacterStats,
limitedWeaponStats,
permanentCharacterStats,
permanentWeaponStats,
starterStats,
starterSelectorStats,
} = usePullHistory();

const banner = {
"limited-character": limitedCharacterStats,
"limited-weapon": limitedWeaponStats,
"permanent-character": permanentCharacterStats,
"permanent-weapon": permanentWeaponStats,
"starter-selector": starterSelectorStats,
starter: starterStats,
};

return (
<div className="flex flex-col h-full justify-between">
<div className="flex h-full flex-col lg:flex-row gap-8 lg:gap-12 desktop:gap-16">
Expand All @@ -28,7 +49,10 @@ export default function Page({
</Link>
</Button>
</div>
<BannerStatsCard {...bannerMetadata[params.name]} />
<BannerStatsCard
stats={banner[params.name]}
{...bannerMetadata[params.name]}
/>
</section>
</div>
</div>
Expand Down
41 changes: 22 additions & 19 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Header } from "@/components/ui/header";
import { Toaster } from "@/components/ui/sonner";
import { Analytics } from "@vercel/analytics/react";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { PullHistoryContextProvider } from "@/contexts/pullHistoryContext";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -24,25 +25,27 @@ export default function RootLayout({
return (
<html lang="en">
<body className={inter.className}>
<ThemeProvider
attribute="class"
defaultTheme="dark"
enableSystem={false}
disableTransitionOnChange
>
<div className="flex min-h-screen w-full flex-col relative bg-accent dark:bg-transparent">
<Header />
<main className="flex justify-center w-full h-full my-10">
<div className="w-full h-full px-3 sm:px-10 max-w-screen-desktop grid">
{children}
</div>
</main>
<Footer />
</div>
</ThemeProvider>
<Toaster richColors />
<Analytics />
<SpeedInsights />
<PullHistoryContextProvider>
<ThemeProvider
attribute="class"
defaultTheme="dark"
enableSystem={false}
disableTransitionOnChange
>
<div className="flex min-h-screen w-full flex-col relative bg-accent dark:bg-transparent">
<Header />
<main className="flex justify-center w-full h-full my-10">
<div className="w-full h-full px-3 sm:px-10 max-w-screen-desktop grid">
{children}
</div>
</main>
<Footer />
</div>
</ThemeProvider>
<Toaster richColors />
<Analytics />
<SpeedInsights />
</PullHistoryContextProvider>
</body>
</html>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function LandingPage() {
role="alert"
>
<span className="text-xs bg-primary-600 rounded-full text-muted-foreground px-2.5 py-1.5">
v1.0.0
v1.1.0
</span>
<span className="text-sm">Wuwa Tracker</span>
<svg
Expand Down
34 changes: 10 additions & 24 deletions src/components/convenes/banner-stats-card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use client";

import { useConveneHistory } from "@/hooks/useConveneHistory";

import Image from "next/image";
import * as React from "react";
import { useState, useEffect } from "react";
Expand All @@ -19,23 +17,18 @@ import AvatarFilter from "./avatar-filter";
import { PullHistory } from "./pull-history";

interface Props {
stats: BannerStats | null;
title: string;
description: string;
pullCost: number;
cardPoolType: number;
bgImgSrc: string;
}

export function BannerStatsCard({
stats,
title,
description,
pullCost,
cardPoolType,
bgImgSrc,
}: Props) {
const { getCardPoolTypeStatistics } = useConveneHistory();

const [stats, setStats] = useState<BannerStats | null>(null);
const [filter, setFilter] = useState<Array<Filtertype>>([
Filtertype.FIVE_STARS,
Filtertype.FOUR_STARS,
Expand Down Expand Up @@ -74,17 +67,6 @@ export function BannerStatsCard({
}
}

useEffect(() => {
const getBannerStats = async () => {
const fetchedBannerStats = await getCardPoolTypeStatistics(
cardPoolType,
pullCost,
);
setStats(fetchedBannerStats);
};
getBannerStats();
}, [cardPoolType, getCardPoolTypeStatistics, pullCost]);

return (
<div className="flex w-full flex-col gap-8">
<Card
Expand All @@ -102,7 +84,7 @@ export function BannerStatsCard({
<div className="flex gap-1">
<h1 className="text-lg">{stats ? stats.totalAstrites : 0}</h1>
<Image
src={"/icons/astrites.png"}
src={"/icons/astrite.png"}
width={30}
height={8}
alt="Astrites"
Expand All @@ -114,9 +96,13 @@ export function BannerStatsCard({
<div className="flex gap-1">
<h1 className="text-lg">{stats ? stats.totalPulls : 0}</h1>
<Image
src={"/icons/special-convene.png"}
width={30}
height={8}
src={
description.includes("Event")
? "/icons/radiant-tide.webp"
: "/icons/lustrous-tide.webp"
}
width={25}
height={7}
alt="Special Convene"
/>
</div>
Expand Down
23 changes: 18 additions & 5 deletions src/components/convenes/convene-avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,32 @@ export function ConveneAvatar({
previousFourStarPullNumber,
}: Props) {
function getBadgeVariant(pullNumber: number) {
if (pullNumber >= 65) {
return "destructive";
} else if (pullNumber >= 30) {
return "warning";
const isFourStar = qualityLevel === 4 && fourStarCurrentPity === 0;

if (isFourStar) {
if (pullNumber >= 8) {
return "destructive";
} else if (pullNumber >= 4) {
return "warning";
} else {
return "success";
}
} else {
return "success";
if (pullNumber >= 65) {
return "destructive";
} else if (pullNumber >= 40) {
return "warning";
} else {
return "success";
}
}
}

const pullNumberToDisplay = getPullNumber(
qualityLevel,
fourStarCurrentPity,
pullNumber,
previousFourStarPullNumber,
previousFiveStarPullNumber,
);

Expand Down
36 changes: 25 additions & 11 deletions src/components/convenes/import-tutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ export function ImportTutorial({ redirectToHistory }: Props) {
onBlur={(e) => setGamePath(e.target.value)}
/>
</div>
<ul className="flex flex-col gap-2 md:ps-8 md:list-disc mt-2 mb-4">
<li>
<p className="text-sm font-normal text-muted-foreground">
Warning: If you edited your <code>Engine.ini</code> file to
disable logs, you&apos;ll have to re-enable them before
opening your convene history, otherwise the script
won&apos;t work.
</p>
</li>
</ul>
</li>
<li className="mb-10 ms-8">
<span className="absolute -start-4 bg-accent rounded-full w-8 h-8 p-3 flex justify-center items-center">
Expand Down Expand Up @@ -144,17 +154,21 @@ export function ImportTutorial({ redirectToHistory }: Props) {
</TooltipContent>
</Tooltip>
</div>
<p className="my-4 text-sm font-normal text-muted-foreground">
Note: The script does not edit your files, it simply extracts
the URL from your logs. You can view the script{" "}
<Link
className="text-yellow-500 hover:text-yellow-600"
href="https://gist.github.com/Luzefiru/19c0759bea1b9e7ef480bb39303b3f6c"
>
here
</Link>
.
</p>
<ul className="flex flex-col gap-2 md:ps-8 md:list-disc mt-2 mb-4">
<li>
<p className="text-sm font-normal text-muted-foreground">
Note: The script does not edit your files, it simply
extracts the URL from your logs. You can view the script{" "}
<Link
className="text-yellow-500 hover:text-yellow-600"
href="https://gist.github.com/Luzefiru/19c0759bea1b9e7ef480bb39303b3f6c"
>
here
</Link>
.
</p>
</li>
</ul>
</li>
<li className="mb-10 ms-8">
<span className="absolute -start-4 bg-accent rounded-full w-8 h-8 p-3 flex justify-center items-center">
Expand Down
2 changes: 1 addition & 1 deletion src/components/convenes/pull-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React from "react";
import InfiniteScroll from "../ui/scroll-area";
import getPullNumber from "@/lib/getPullNumber";

import { useState } from "react";
import { BannerStats } from "@/types/BannerStats";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import {
Expand Down Expand Up @@ -62,6 +61,7 @@ export function PullHistory({ stats }: Props) {
item.qualityLevel,
item.fourStarCurrentPity,
item.pullNumber,
item.previousFourStarPullNumber,
item.previousFiveStarPullNumber,
)}
</TableCell>
Expand Down
Loading

0 comments on commit a176e7d

Please sign in to comment.