From e5ba47943f5deb05199e2d46eefa1b8672578592 Mon Sep 17 00:00:00 2001 From: "github-actions[bot] (aider)" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 22:20:31 +0000 Subject: [PATCH 1/5] feat: add loading screen for initial user count fetch in UserCount component --- src/components/usercount.tsx | 13 +++++++++++++ src/lib/store.ts | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/components/usercount.tsx b/src/components/usercount.tsx index 721b2ba..56b2a0b 100644 --- a/src/components/usercount.tsx +++ b/src/components/usercount.tsx @@ -7,18 +7,31 @@ import { useStore } from "@/lib/store"; export default function UserCount() { const { count, setCount } = useStore(); +export default function UserCount() { + const { count, setCount, isLoading, setLoading } = useStore(); useEffect(() => { async function fetchUserCount() { + setLoading(true); const data = await fetchy.get("/api/user"); console.log(data.count); setCount((data.count as number) || 80); + setLoading(false); } fetchUserCount(); }, []); + if (isLoading) { + return ( +
+ +
+ ); + } + // Array to maintain tier maximum counts const tierMaxCounts = [100, 200, 500, 1000, 2500, 5000, 10000]; + // ... rest of the component // Function to calculate progress based on the entire range (0 to 100%) const getProgressValue = (count: number): number => { diff --git a/src/lib/store.ts b/src/lib/store.ts index 723449a..159a7a3 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -2,14 +2,18 @@ import { create } from "zustand"; export type Store = { count: number; + isLoading: boolean; setCount: (count: number) => void; + setLoading: (loading: boolean) => void; userID: string; setUserID: (userID: string) => void; }; export const useStore = create((set) => ({ count: 0, + isLoading: true, setCount: (count: number) => set({ count }), + setLoading: (loading: boolean) => set({ isLoading: loading }), userID: "", setUserID: (userID: string) => set({ userID }), })); From f2171bde6dc5c611d5e4db1fff9cad751b1e60c7 Mon Sep 17 00:00:00 2001 From: Nisal Chandrasekara Date: Wed, 2 Oct 2024 03:53:18 +0530 Subject: [PATCH 2/5] Create pr-auto-commit.yml --- .github/workflows/pr-auto-commit.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/pr-auto-commit.yml diff --git a/.github/workflows/pr-auto-commit.yml b/.github/workflows/pr-auto-commit.yml new file mode 100644 index 0000000..058997e --- /dev/null +++ b/.github/workflows/pr-auto-commit.yml @@ -0,0 +1,39 @@ +name: Vercel Kickstart + +on: + pull_request: + types: + - synchronize + - opened + +jobs: + commit_as_user: + runs-on: ubuntu-latest + + steps: + - name: Checkout PR branch + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Set up Git with the target user info + env: + GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }} + GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} + run: | + git config user.name "$GIT_USER_NAME" + git config user.email "$GIT_USER_EMAIL" + + - name: Update timestamp.txt with current time + run: | + echo "Last updated: $(date)" > timestamp.txt + git add timestamp.txt + git commit -m "Vercel Magic 🪄 - Update timestamp.txt with latest date" + + - name: Push as CMNisal + env: + GITHUB_TOKEN: ${{ secrets.USER_PAT }} # The PAT of the target user + PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} + run: | + git push --force-with-lease origin HEAD:$PR_HEAD_REF From b1fb54976b08bf76dc0d4568de271dd5e3c03ea0 Mon Sep 17 00:00:00 2001 From: cmnisal Date: Tue, 1 Oct 2024 22:24:38 +0000 Subject: [PATCH 3/5] =?UTF-8?q?Vercel=20Magic=20=F0=9F=AA=84=20-=20Update?= =?UTF-8?q?=20timestamp.txt=20with=20latest=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- timestamp.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 timestamp.txt diff --git a/timestamp.txt b/timestamp.txt new file mode 100644 index 0000000..3ad1814 --- /dev/null +++ b/timestamp.txt @@ -0,0 +1 @@ +Last updated: Tue Oct 1 22:24:38 UTC 2024 From dcc3b69a37e3ecf761defafe565b27db23e9b3a9 Mon Sep 17 00:00:00 2001 From: Nisal Chandrasekara Date: Wed, 2 Oct 2024 03:56:23 +0530 Subject: [PATCH 4/5] Update timestamp.txt From a31ac4668498e50c5da915ccb28b0bee8206604e Mon Sep 17 00:00:00 2001 From: cmnisal Date: Tue, 1 Oct 2024 22:26:35 +0000 Subject: [PATCH 5/5] =?UTF-8?q?Vercel=20Magic=20=F0=9F=AA=84=20-=20Update?= =?UTF-8?q?=20timestamp.txt=20with=20latest=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- timestamp.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timestamp.txt b/timestamp.txt index 3ad1814..59a2a56 100644 --- a/timestamp.txt +++ b/timestamp.txt @@ -1 +1 @@ -Last updated: Tue Oct 1 22:24:38 UTC 2024 +Last updated: Tue Oct 1 22:26:35 UTC 2024