Branchwell

Skillfarm / website · skillfarm.ai / src / lib / tiers.ts

Raw 1.9 KB on c724bfa127f7a93b48788385cedf1e60cb4e7943
1export type Tier = {
2 key: string;
3 name: string;
4 threshold: number;
5 perk: string;
6 sharesPerWeek: number;
7 color: string;
8};
9
10export const TIERS: Tier[] = [
11 { key: 'seedling', name: 'Seedling', threshold: 0, perk: 'Your own profile and portfolio page', sharesPerWeek: 3, color: '#93B87A' },
12 { key: 'grower', name: 'Grower', threshold: 100, perk: 'Tier badge on every one of your skill cards', sharesPerWeek: 5, color: '#5A8A4A' },
13 { key: 'farmer', name: 'Farmer', threshold: 400, perk: 'Listed in the Growers directory', sharesPerWeek: 8, color: '#E9A23B' },
14 { key: 'harvester', name: 'Harvester', threshold: 1000, perk: 'Eligible for the weekly Fresh Harvest homepage feature', sharesPerWeek: 12, color: '#D9673F' },
15 { key: 'homesteader', name: 'Homesteader', threshold: 2500, perk: 'Joins the homepage portfolio spotlight rotation', sharesPerWeek: 20, color: '#8C4A2F' },
16 { key: 'blue-ribbon', name: 'Blue Ribbon', threshold: 6000, perk: 'Permanent hall of fame spot', sharesPerWeek: 30, color: '#3F74B5' },
17];
18
19export function tierFor(seeds: number): Tier {
20 let t = TIERS[0];
21 for (const tier of TIERS) if (seeds >= tier.threshold) t = tier;
22 return t;
23}
24
25export function tierIndex(seeds: number): number {
26 return TIERS.indexOf(tierFor(seeds));
27}
28
29export function nextTier(seeds: number): Tier | null {
30 return TIERS[tierIndex(seeds) + 1] ?? null;
31}
32
33export function tierProgress(seeds: number): number {
34 const cur = tierFor(seeds);
35 const nxt = nextTier(seeds);
36 if (!nxt) return 100;
37 return Math.max(0, Math.min(100, Math.round(((seeds - cur.threshold) / (nxt.threshold - cur.threshold)) * 100)));
38}
39
40export const SEEDS = {
41 share: 50,
42 install: 2,
43 replant: 10,
44 review: 5,
45 like: 1,
46} as const;
47
48export const LIMITS = {
49 likeSeedsPerSkillPerDay: 20,
50 installSeedsPerSkillPerDay: 50,
51 minAccountAgeDays: 3,
52 minReviewLength: 40,
53 likeActionsPerHour: 60,
54 reviewsPerDay: 10,
55 reportsPerDay: 10,
56 versionsPerDay: 10,
57} as const;