fix: track frontend sample data hidden by overly broad data/ ignore rule

frontend/src/data/sample.ts (imported by Home/CategoriesPage) was never
committed because the root .gitignore ignored every path named data/.
A fresh clone would have failed the frontend build.
This commit is contained in:
Daniel Samson committed 2026-10-30 15:34:50 +00:00
1 parent 253052c551
commit 9144411e0f
1 file changed
+113
+113
View File
@@ -0,0 +1,113 @@
/**
* Sample data used until the backend article endpoints are available
* (planned for a later milestone). The home page falls back to this
* dataset whenever `GET /api/v1/articles` is unavailable.
*/
import type { Article, Author, Category } from '../types';
export const sampleAuthors: Author[] = [
{
id: 1,
name: 'Ada Lovelace',
email: 'ada@example.com',
bio: 'Writes about technology and computation.',
},
{
id: 2,
name: 'Grace Hopper',
email: 'grace@example.com',
bio: 'Covers science and engineering.',
},
{
id: 3,
name: 'Alan Turing',
email: 'alan@example.com',
bio: 'Follows sports and culture.',
},
];
export const sampleCategories: Category[] = [
{ id: 1, name: 'Technology', slug: 'technology' },
{ id: 2, name: 'Science', slug: 'science' },
{ id: 3, name: 'Sports', slug: 'sports' },
{ id: 4, name: 'Culture', slug: 'culture' },
];
const authorOf = (id: number): Author => sampleAuthors.find((a) => a.id === id) as Author;
const categoryOf = (id: number): Category =>
sampleCategories.find((c) => c.id === id) as Category;
export const sampleArticles: Article[] = [
{
id: 1,
title: 'Inside the new wave of open-source language models',
content:
'Open-source language models are closing the gap with proprietary systems, and the ecosystem around them is growing fast. Researchers now release pretrained weights alongside detailed training recipes, letting smaller teams fine-tune models for narrow tasks that once required large budgets. The result is a new layer of the AI stack: community-maintained tooling for evaluation, deployment, and safety testing that moves at a pace big vendors struggle to match. As hardware costs keep falling, expect the line between "research model" and "production model" to blur further this year.',
authorId: 1,
author: authorOf(1),
categoryId: 1,
category: categoryOf(1),
createdAt: '2025-06-02T09:30:00Z',
published: true,
},
{
id: 2,
title: 'Fusion milestone: net energy gain repeated for the third time',
content:
'Scientists have repeated a net-energy-gain fusion reaction for the third consecutive time, confirming that last months breakthrough was not a fluke. The latest run sustained the plasma for a record duration and produced energy output within a few percent of the original measurement. Engineers now say the remaining challenges are engineering, not physics: materials that survive repeated shots and power systems that deliver pulses on demand. A commercial demonstration plant could enter the design phase as early as next decade.',
authorId: 2,
author: authorOf(2),
categoryId: 2,
category: categoryOf(2),
createdAt: '2025-05-28T14:10:00Z',
published: true,
},
{
id: 3,
title: 'City marathon sets record turnout as first-timers flood the course',
content:
'More than 40,000 runners started this weekend city marathon, a record that organizers attributed to a wave of first-time participants. The 21-kilometer fun run sold out in under an hour, and volunteers reported the most positive start-line atmosphere in the events history. Pacing groups, music zones, and a free post-race breakfast kept the mood festive even in the rain. Officials are already planning capacity expansions for next year, with an eye on adding a night race.',
authorId: 3,
author: authorOf(3),
categoryId: 3,
category: categoryOf(3),
createdAt: '2025-05-25T08:00:00Z',
published: true,
},
{
id: 4,
title: 'The quiet return of the neighborhood library',
content:
'After years of budget cuts, the neighborhood library is staging an unlikely comeback. Community volunteers now staff the Saturday makerspace, where 3D printing, sewing machines, and a small recording studio are booked weeks in advance. Librarians report that circulation is up, but the real story is programming: repair cafés, language tables, and civic workshops that have made the building a second living room for the district. City planners are taking note, and two more branches are slated for renovation this fall.',
authorId: 1,
author: authorOf(1),
categoryId: 4,
category: categoryOf(4),
createdAt: '2025-05-20T17:45:00Z',
published: true,
},
{
id: 5,
title: 'Rust keeps climbing the systems programming charts',
content:
'Rust has moved up again in the annual systems programming survey, now the most-wanted language for kernel and infrastructure work among respondents. Adoption is no longer limited to startups: several large platforms report that new storage and networking services are written in Rust by default. The ecosystems memory-safety guarantees, combined with a mature async story, continue to draw engineers from C and C++. Tooling improvements in debugging and profiling have been the most cited reasons for teams crossing over this year.',
authorId: 2,
author: authorOf(2),
categoryId: 1,
category: categoryOf(1),
createdAt: '2025-05-15T11:20:00Z',
published: true,
},
{
id: 6,
title: 'Ocean robots map the deepest trenches in record time',
content:
'A fleet of autonomous underwater vehicles has completed the most detailed survey of the ocean trench yet, mapping 80 percent of the basin floor in six weeks. The robots, equipped with multibeam sonar and high-resolution cameras, collected terabytes of data that reveal previously unknown seamounts and hydrothermal vent fields. Biologists have already flagged three candidate species from the first batch of imagery. The team plans to return next winter with sampling landers to study the vent communities up close.',
authorId: 3,
author: authorOf(3),
categoryId: 2,
category: categoryOf(2),
createdAt: '2025-05-10T19:05:00Z',
published: true,
},
];