diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 187133fc..5e128140 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 10a8152c..6df396e1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -49,3 +49,8 @@ _Smartphone (please complete the following information):_ ## Additional Context _Add any other context about the problem here._ + + + + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 451b9888..069f7264 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. + + + + + diff --git a/.github/README.md b/.github/README.md index 4f8cad69..d38367e5 100644 --- a/.github/README.md +++ b/.github/README.md @@ -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. diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 00000000..006c57b6 --- /dev/null +++ b/.github/workflows/tag.yml @@ -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 diff --git a/public/icons/astrite.png b/public/icons/astrite.png new file mode 100644 index 00000000..bf79d52c Binary files /dev/null and b/public/icons/astrite.png differ diff --git a/public/icons/astrites.png b/public/icons/astrites.png deleted file mode 100644 index 8ac22534..00000000 Binary files a/public/icons/astrites.png and /dev/null differ diff --git a/public/icons/lustrous-tide.webp b/public/icons/lustrous-tide.webp new file mode 100644 index 00000000..1391d426 Binary files /dev/null and b/public/icons/lustrous-tide.webp differ diff --git a/public/icons/radiant-tide.webp b/public/icons/radiant-tide.webp new file mode 100644 index 00000000..4aa885bb Binary files /dev/null and b/public/icons/radiant-tide.webp differ diff --git a/src/app/(main-layout)/convene/[name]/page.tsx b/src/app/(main-layout)/convene/[name]/page.tsx index e8f39dcd..3fc463fb 100644 --- a/src/app/(main-layout)/convene/[name]/page.tsx +++ b/src/app/(main-layout)/convene/[name]/page.tsx @@ -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, @@ -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 (
@@ -28,7 +49,10 @@ export default function Page({
- +
diff --git a/src/app/layout.tsx b/src/app/layout.tsx index ff4187b3..22a1a5a6 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -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"] }); @@ -24,25 +25,27 @@ export default function RootLayout({ return ( - -
-
-
-
- {children} -
-
-
-
- - - + + +
+
+
+
+ {children} +
+
+
+
+
+ + + +
); diff --git a/src/app/page.tsx b/src/app/page.tsx index f52f47d1..a586a946 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -16,7 +16,7 @@ export default function LandingPage() { role="alert" > - v1.0.0 + v1.1.0 Wuwa Tracker (null); const [filter, setFilter] = useState>([ Filtertype.FIVE_STARS, Filtertype.FOUR_STARS, @@ -74,17 +67,6 @@ export function BannerStatsCard({ } } - useEffect(() => { - const getBannerStats = async () => { - const fetchedBannerStats = await getCardPoolTypeStatistics( - cardPoolType, - pullCost, - ); - setStats(fetchedBannerStats); - }; - getBannerStats(); - }, [cardPoolType, getCardPoolTypeStatistics, pullCost]); - return (

{stats ? stats.totalAstrites : 0}

Astrites

{stats ? stats.totalPulls : 0}

Special Convene
diff --git a/src/components/convenes/convene-avatar.tsx b/src/components/convenes/convene-avatar.tsx index 3445d7f5..7e89c636 100644 --- a/src/components/convenes/convene-avatar.tsx +++ b/src/components/convenes/convene-avatar.tsx @@ -25,12 +25,24 @@ 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"; + } } } @@ -38,6 +50,7 @@ export function ConveneAvatar({ qualityLevel, fourStarCurrentPity, pullNumber, + previousFourStarPullNumber, previousFiveStarPullNumber, ); diff --git a/src/components/convenes/import-tutorial.tsx b/src/components/convenes/import-tutorial.tsx index 132587c0..00a7e68d 100644 --- a/src/components/convenes/import-tutorial.tsx +++ b/src/components/convenes/import-tutorial.tsx @@ -98,6 +98,16 @@ export function ImportTutorial({ redirectToHistory }: Props) { onBlur={(e) => setGamePath(e.target.value)} /> +
    +
  • +

    + Warning: If you edited your Engine.ini file to + disable logs, you'll have to re-enable them before + opening your convene history, otherwise the script + won't work. +

    +
  • +
  • @@ -144,17 +154,21 @@ export function ImportTutorial({ redirectToHistory }: Props) { -

    - Note: The script does not edit your files, it simply extracts - the URL from your logs. You can view the script{" "} - - here - - . -

    +
      +
    • +

      + Note: The script does not edit your files, it simply + extracts the URL from your logs. You can view the script{" "} + + here + + . +

      +
    • +
  • diff --git a/src/components/convenes/pull-history.tsx b/src/components/convenes/pull-history.tsx index e50a86f9..f3464139 100644 --- a/src/components/convenes/pull-history.tsx +++ b/src/components/convenes/pull-history.tsx @@ -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 { @@ -62,6 +61,7 @@ export function PullHistory({ stats }: Props) { item.qualityLevel, item.fourStarCurrentPity, item.pullNumber, + item.previousFourStarPullNumber, item.previousFiveStarPullNumber, )} diff --git a/src/contexts/pullHistoryContext.tsx b/src/contexts/pullHistoryContext.tsx new file mode 100644 index 00000000..21a2559d --- /dev/null +++ b/src/contexts/pullHistoryContext.tsx @@ -0,0 +1,102 @@ +"use client"; + +import { useConveneHistory } from "@/hooks/useConveneHistory"; +import { BannerStats } from "@/types/BannerStats"; +import { + ReactNode, + createContext, + useContext, + useEffect, + SetStateAction, + Dispatch, + useState, +} from "react"; + +type pullHistoryContextType = { + limitedCharacterStats: BannerStats | null; + setLimitedCharacterStats: Dispatch>; + limitedWeaponStats: BannerStats | null; + setLimitedWeaponStats: Dispatch>; + permanentCharacterStats: BannerStats | null; + setPermanentCharacterStats: Dispatch>; + permanentWeaponStats: BannerStats | null; + setPermanentWeaponStats: Dispatch>; + starterStats: BannerStats | null; + setStarterStats: Dispatch>; + starterSelectorStats: BannerStats | null; + setStarterSelectorStats: Dispatch>; +}; + +const pullHistoryContext = createContext({ + limitedCharacterStats: null, + setLimitedCharacterStats: () => {}, + limitedWeaponStats: null, + setLimitedWeaponStats: () => {}, + permanentCharacterStats: null, + setPermanentCharacterStats: () => {}, + permanentWeaponStats: null, + setPermanentWeaponStats: () => {}, + starterStats: null, + setStarterStats: () => {}, + starterSelectorStats: null, + setStarterSelectorStats: () => {}, +}); + +export const PullHistoryContextProvider = ({ + children, +}: { + children: ReactNode; +}) => { + const { getCardPoolTypeStatistics } = useConveneHistory(); + + const [limitedCharacterStats, setLimitedCharacterStats] = + useState(null); + const [limitedWeaponStats, setLimitedWeaponStats] = + useState(null); + const [permanentCharacterStats, setPermanentCharacterStats] = + useState(null); + const [permanentWeaponStats, setPermanentWeaponStats] = + useState(null); + const [starterStats, setStarterStats] = useState(null); + const [starterSelectorStats, setStarterSelectorStats] = + useState(null); + + useEffect(() => { + const getBannerStats = async () => { + setLimitedCharacterStats(await getCardPoolTypeStatistics(1, 160)); + setLimitedWeaponStats(await getCardPoolTypeStatistics(2, 160)); + setPermanentCharacterStats(await getCardPoolTypeStatistics(3, 160)); + setPermanentWeaponStats(await getCardPoolTypeStatistics(4, 160)); + setStarterStats(await getCardPoolTypeStatistics(5, 128)); + setStarterSelectorStats(await getCardPoolTypeStatistics(6, 160)); + }; + getBannerStats(); + }, [getCardPoolTypeStatistics]); + return ( + + {children} + + ); +}; + +export function usePullHistory() { + const context = useContext(pullHistoryContext); + if (context === undefined) + throw new Error("pullHistoryContext used outside of the provider"); + return context; +} diff --git a/src/lib/getPullNumber.ts b/src/lib/getPullNumber.ts index cd9b68e2..b4ecb7f1 100644 --- a/src/lib/getPullNumber.ts +++ b/src/lib/getPullNumber.ts @@ -4,6 +4,7 @@ * @param qualityLevel - the rarity level of a character * @param fourStarCurrentPity - the current pity for four star items (out of 10) * @param pullNumber - the overall pull number which an item was acquired + * @param previousFourStarPullNumber - the last pity in which a four star item was pulled * @param previousFiveStarPullNumber - the last pity in which a five star item was pulled * @returns an integer that represents an item's current pull number within pity */ @@ -11,12 +12,13 @@ export default function getPullNumber( qualityLevel: number, fourStarCurrentPity: number, pullNumber: number, + previousFourStarPullNumber: number, previousFiveStarPullNumber: number, ) { const isFourStar = qualityLevel === 4 && fourStarCurrentPity === 0; - if (isFourStar) { - return pullNumber - previousFiveStarPullNumber; - } - return pullNumber - previousFiveStarPullNumber; + return ( + pullNumber - + (isFourStar ? previousFourStarPullNumber : previousFiveStarPullNumber) + ); }