feat: merge AI / Cloud / HomeLab into Tech pill with sub-sections
- Removed AI, Cloud, HomeLab as top-level pills - Tech pill now matches all their slugs (ai, ml, cloud, homelab, security, dev) - Tech view shows a sectioned front page: AI · Cloud · HomeLab · Security · Dev · Technology - Sub-sections defined via NewsSection.techSubSections + StoryPill.subSections - digest() extracted to makeDigest(sections:) so any pill can have sections - Tech auto-loads 100 stories to fill its sub-sections (same as All) - "All" Tech section in the main feed now links to Tech pill Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -216,10 +216,7 @@ enum StoryPill: String, CaseIterable, Identifiable {
|
||||
case all = "All"
|
||||
case f1 = "F1"
|
||||
case sport = "Sport"
|
||||
case ai = "AI"
|
||||
case cloud = "Cloud"
|
||||
case homelab = "HomeLab"
|
||||
case tech = "Tech"
|
||||
case tech = "Tech" // covers AI, Cloud, HomeLab — use sub-sections inside
|
||||
case uganda = "Uganda"
|
||||
case southAfrica = "South Africa"
|
||||
case canada = "Canada"
|
||||
@@ -233,18 +230,27 @@ enum StoryPill: String, CaseIterable, Identifiable {
|
||||
case .all: return []
|
||||
case .f1: return ["formula-1"]
|
||||
case .sport: return ["sports", "esports"]
|
||||
case .ai: return ["artificial-intelligence", "machine-learning", "robotics"]
|
||||
case .cloud: return ["cloud-computing"]
|
||||
case .homelab: return ["homelab"]
|
||||
case .tech: return ["technology", "programming-and-software-development",
|
||||
"cybersecurity", "security", "privacy-and-data-protection",
|
||||
"web-design-and-ui-ux", "wordpress-and-web-development"]
|
||||
case .tech: return [
|
||||
"technology", "programming-and-software-development",
|
||||
"cybersecurity", "security", "privacy-and-data-protection",
|
||||
"web-design-and-ui-ux", "wordpress-and-web-development",
|
||||
"artificial-intelligence", "machine-learning", "robotics",
|
||||
"cloud-computing", "homelab",
|
||||
]
|
||||
case .uganda: return ["uganda"]
|
||||
case .southAfrica: return ["south-africa"]
|
||||
case .canada: return ["canada"]
|
||||
case .unitedStates: return ["united-states"]
|
||||
}
|
||||
}
|
||||
|
||||
/// Sub-sections to show inside the card layout for this pill (nil = flat).
|
||||
var subSections: [NewsSection]? {
|
||||
switch self {
|
||||
case .tech: return NewsSection.techSubSections
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension StorySummary {
|
||||
@@ -289,17 +295,26 @@ struct NewsSection: Identifiable {
|
||||
let pill: StoryPill?
|
||||
|
||||
static let sections: [NewsSection] = [
|
||||
.init(id: "us", label: "US", slugs: ["united-states"], pill: .unitedStates),
|
||||
.init(id: "world", label: "World", slugs: ["world-news", "news", "news-and-current-affairs"], pill: nil),
|
||||
.init(id: "politics", label: "Politics", slugs: ["politics", "human-rights", "investigative"], pill: nil),
|
||||
.init(id: "business", label: "Business", slugs: ["business", "finance", "fintech", "cryptocurrency", "blockchain", "entrepreneur", "startups", "real-estate"], pill: nil),
|
||||
.init(id: "ai", label: "AI", slugs: ["artificial-intelligence", "machine-learning", "robotics"], pill: .ai),
|
||||
.init(id: "technology", label: "Technology", slugs: ["technology", "programming-and-software-development", "cybersecurity", "security", "web-design-and-ui-ux", "wordpress-and-web-development", "privacy-and-data-protection", "cloud-computing"], pill: .tech),
|
||||
.init(id: "africa", label: "Africa", slugs: ["africa", "east-africa", "south-africa", "uganda"], pill: nil),
|
||||
.init(id: "sport", label: "Sport", slugs: ["sports", "esports", "formula-1"], pill: .sport),
|
||||
.init(id: "science", label: "Science", slugs: ["science", "astronomy", "environment", "green-technology", "sustainability"], pill: nil),
|
||||
.init(id: "entertainment", label: "Entertainment", slugs: ["entertainment", "music", "pop-culture", "video-game", "arts-and-culture", "books-and-literature"], pill: nil),
|
||||
.init(id: "health", label: "Health", slugs: ["health", "health-and-wellness", "mental-health"], pill: nil),
|
||||
.init(id: "lifestyle", label: "Lifestyle", slugs: ["lifestyle", "food-and-drink", "travel", "gardening", "outdoor-and-hiking", "parenting-and-family", "interior-design-and-home-decor", "photography", "self-improvement-and-personal-development", "education", "e-learning"], pill: nil),
|
||||
.init(id: "us", label: "US", slugs: ["united-states"], pill: .unitedStates),
|
||||
.init(id: "world", label: "World", slugs: ["world-news", "news", "news-and-current-affairs"], pill: nil),
|
||||
.init(id: "politics", label: "Politics", slugs: ["politics", "human-rights", "investigative"], pill: nil),
|
||||
.init(id: "business", label: "Business", slugs: ["business", "finance", "fintech", "cryptocurrency", "blockchain", "entrepreneur", "startups", "real-estate"], pill: nil),
|
||||
.init(id: "tech", label: "Tech", slugs: ["technology", "programming-and-software-development", "cybersecurity", "security", "web-design-and-ui-ux", "wordpress-and-web-development", "privacy-and-data-protection", "cloud-computing", "artificial-intelligence", "machine-learning", "robotics", "homelab"], pill: .tech),
|
||||
.init(id: "africa", label: "Africa", slugs: ["africa", "east-africa", "south-africa", "uganda"], pill: nil),
|
||||
.init(id: "sport", label: "Sport", slugs: ["sports", "esports", "formula-1"], pill: .sport),
|
||||
.init(id: "science", label: "Science", slugs: ["science", "astronomy", "environment", "green-technology", "sustainability"], pill: nil),
|
||||
.init(id: "entertainment", label: "Entertainment",slugs: ["entertainment", "music", "pop-culture", "video-game", "arts-and-culture", "books-and-literature"], pill: nil),
|
||||
.init(id: "health", label: "Health", slugs: ["health", "health-and-wellness", "mental-health"], pill: nil),
|
||||
.init(id: "lifestyle", label: "Lifestyle", slugs: ["lifestyle", "food-and-drink", "travel", "gardening", "outdoor-and-hiking", "parenting-and-family", "interior-design-and-home-decor", "photography", "self-improvement-and-personal-development", "education", "e-learning"], pill: nil),
|
||||
]
|
||||
|
||||
/// Sub-sections shown inside the Tech pill view.
|
||||
static let techSubSections: [NewsSection] = [
|
||||
.init(id: "t-ai", label: "AI", slugs: ["artificial-intelligence", "machine-learning", "robotics"], pill: nil),
|
||||
.init(id: "t-cloud", label: "Cloud", slugs: ["cloud-computing"], pill: nil),
|
||||
.init(id: "t-homelab", label: "HomeLab", slugs: ["homelab"], pill: nil),
|
||||
.init(id: "t-security", label: "Security", slugs: ["cybersecurity", "security", "privacy-and-data-protection"], pill: nil),
|
||||
.init(id: "t-dev", label: "Dev", slugs: ["programming-and-software-development", "web-design-and-ui-ux", "wordpress-and-web-development"], pill: nil),
|
||||
.init(id: "t-tech", label: "Technology", slugs: ["technology"], pill: nil),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user