Skip to content

Add /mayor/[year] and /mayor/all pages to display mayor data#1507

Open
matthias-luger wants to merge 4 commits intodevelopfrom
add-mayor-pages
Open

Add /mayor/[year] and /mayor/all pages to display mayor data#1507
matthias-luger wants to merge 4 commits intodevelopfrom
add-mayor-pages

Conversation

@matthias-luger
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new App Router pages to display Hypixel SkyBlock mayor election data for a specific year (/mayor/[year]) and a multi-year view (/mayor/all) using new client-side components that fetch mayor election periods and render them in a structured UI.

Changes:

  • Introduces /mayor/all page backed by a new AllMayors client component fetching a 5-year election window.
  • Introduces /mayor/[year] page backed by a new YearlyMayor client component fetching election results for a single year.
  • Adds a new MayorDetailsDisplay component for rendering election periods (accordion + candidate/perk details), plus related styling.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
components/Mayor/YearlyMayor.tsx Fetches mayor-election data for a given year and renders it via MayorDetailsDisplay.
components/Mayor/MayorDetailsDisplay.tsx Main UI renderer for election periods, candidate selection, and perk display.
components/Mayor/MayorDetails.tsx Additional mayor details component (currently appears unused) with its own fetch + accordion UI.
components/Mayor/MayorDetails.module.css Styles for mayor-related pages/components (container, links, accordion styling).
components/Mayor/AllMayors.tsx Fetches mayor-election data for the “last 5 years” window and renders it via MayorDetailsDisplay.
app/mayor/all/page.tsx Adds the /mayor/all route and composes layout (NavBar/Search + content).
app/mayor/[year]/page.tsx Adds the /mayor/[year] route and composes layout (NavBar/Search + content).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +15
const yearInt = parseInt(year, 10);
const { data: mayorYearData, isLoading, error } = useGetApiMayorYear(yearInt, {
query: {
enabled: !isNaN(yearInt),
},
});
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6227d27. /mayor/[year] now shows an explicit Invalid year state for non-numeric input instead of rendering a blank details view, and I also aligned the dynamic route page typing so the page builds correctly. Screenshot: /tmp/mayor-feedback/mayor-invalid-year.png

Comment on lines +25 to +31
{election.candidates?.map(candidate => (
<ListGroup.Item
key={candidate.key}
action
onClick={() => setSelectedCandidateKey(candidate.key ?? null)}
className={`px-3 py-2 mb-2 rounded border ${selectedCandidateKey === candidate.key ? 'bg-primary text-white border-primary shadow' : 'bg-transparent text-light border-secondary opacity-75'}`}
style={{ cursor: 'pointer', transition: 'all 0.2s ease' }}
Comment on lines +44 to +46
<h5 className="text-info mb-3 border-bottom pb-2">
{selectedCandidateKey === election.winner?.key ? "Election Winner" : "Candidate Details"}
</h5>
Comment on lines +53 to +54
{selectedCandidate.perks?.map(perk => (
<Col sm={12} lg={6} key={perk.name}>
Comment on lines +102 to +105
year?: string;
}

export function MayorDetailsDisplay({ elections, isSingleYear, year }: Props) {
Comment on lines +26 to +27
{election.candidates?.map(candidate => (
<li key={candidate.key}>{candidate.name}</li>
Comment on lines +39 to +40
{election.winner.perks?.map(perk => (
<li key={perk.name}>{perk.name}: {perk.description}</li>
Comment thread app/mayor/all/page.tsx
Comment on lines +7 to +10
export const metadata: Metadata = {
title: "All Mayor Flips",
description: "A list of all mayor flips from the last 5 years.",
};
Comment thread app/mayor/[year]/page.tsx
Comment on lines +7 to +10
export const metadata: Metadata = {
title: "Mayor Flips",
description: "A list of items that are affected by the current or upcoming mayor.",
};
Comment on lines +1 to +27
"use client";
import { useGetApiMayorYear } from "../../api/_generated/skyApi";
import { MayorDetailsDisplay } from "./MayorDetailsDisplay";

type Props = {
year: string;
};

export function YearlyMayor({ year }: Props) {
const yearInt = parseInt(year, 10);
const { data: mayorYearData, isLoading, error } = useGetApiMayorYear(yearInt, {
query: {
enabled: !isNaN(yearInt),
},
});

if (isLoading) {
return <div>Loading...</div>;
}

if (error) {
return <div>Error loading mayor data for year {year}</div>;
}

const elections = mayorYearData?.data ? (Array.isArray(mayorYearData.data) ? mayorYearData.data : [mayorYearData.data]) : [];

return <MayorDetailsDisplay elections={elections} isSingleYear={true} year={year} />;
Agent-Logs-Url: https://github.com/Coflnet/hypixel-react/sessions/c31a847d-2c22-475c-9018-4e6bfe4e5f46

Co-authored-by: matthias-luger <58751503+matthias-luger@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • accounts.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • cdn.cypress.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node index.js --exec install (dns block)
  • clients2.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • clientservices.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • content-autofill.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • mc-heads.net
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • redirector.gvt1.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • s.nitropay.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • safebrowsingohttpgateway.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)
  • www.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=6530 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/com.google.Chrome.scoped_dir.EtYFuf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,5991879778854431603,446268816111279171,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,7411261445766533250,4443111614082730496,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --headless=new --disable-gpu --no-sandbox --window-size=1440,1200 --screenshot=/tmp/mayor-feedback/mayor-invalid-year.png REDACTED modules/@npmcli/run-script/lib/node-gyp-bin/sh ame (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants