Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
72 lines
2.2 KiB
TypeScript
72 lines
2.2 KiB
TypeScript
/**
|
|
* A horizontal chip row for choosing the leaderboard ranking metric
|
|
* (reputation | followers | clones | rating | published | win_score). Mirrors
|
|
* the marketplace sort-chip pattern. Presentational + selection callback only;
|
|
* the parent (`app/leaderboard.tsx`) owns the metric of record and the fetch.
|
|
*/
|
|
|
|
import { Pressable, ScrollView, StyleSheet, Text } from "react-native";
|
|
|
|
import { LEADERBOARD_METRICS, type LeaderboardMetric } from "@/lib/types";
|
|
import { colors } from "@/components/me/theme";
|
|
|
|
/** Human-readable labels for each ranking metric, in the union's order. */
|
|
export const METRIC_LABELS: Readonly<Record<LeaderboardMetric, string>> = {
|
|
reputation: "Reputation",
|
|
followers: "Followers",
|
|
clones: "Clones",
|
|
rating: "Rating",
|
|
published: "Published",
|
|
win_score: "Win score",
|
|
};
|
|
|
|
interface LeaderboardMetricPickerProps {
|
|
metric: LeaderboardMetric;
|
|
onChange: (metric: LeaderboardMetric) => void;
|
|
}
|
|
|
|
export function LeaderboardMetricPicker({
|
|
metric,
|
|
onChange,
|
|
}: LeaderboardMetricPickerProps) {
|
|
return (
|
|
<ScrollView
|
|
horizontal
|
|
showsHorizontalScrollIndicator={false}
|
|
contentContainerStyle={styles.row}
|
|
>
|
|
{LEADERBOARD_METRICS.map((option) => {
|
|
const active = option === metric;
|
|
return (
|
|
<Pressable
|
|
key={option}
|
|
style={[styles.chip, active && styles.chipActive]}
|
|
onPress={() => onChange(option)}
|
|
accessibilityRole="button"
|
|
accessibilityState={{ selected: active }}
|
|
>
|
|
<Text style={[styles.chipText, active && styles.chipTextActive]}>
|
|
{METRIC_LABELS[option]}
|
|
</Text>
|
|
</Pressable>
|
|
);
|
|
})}
|
|
</ScrollView>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
row: { flexDirection: "row", gap: 8, paddingRight: 8 },
|
|
chip: {
|
|
backgroundColor: colors.card,
|
|
borderColor: colors.border,
|
|
borderWidth: 1,
|
|
borderRadius: 999,
|
|
paddingHorizontal: 14,
|
|
paddingVertical: 8,
|
|
},
|
|
chipActive: { backgroundColor: colors.primary, borderColor: colors.primary },
|
|
chipText: { color: colors.textSecondary, fontSize: 13 },
|
|
chipTextActive: { color: colors.textPrimary, fontWeight: "700" },
|
|
});
|