mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
32ac8e73fd
* Fix Biome lint violations and add Biome CI check Biome was not configured to respect .gitignore, so ~92% of the 13,355 reported diagnostics came from gitignored build artifacts. Enable VCS integration (useIgnoreFile), apply safe auto-fixes across the repo, fix the remaining mechanical errors by hand, downgrade judgment-call a11y / dangerouslySetInnerHTML rules to warnings, and add a 'biome ci' job to the Lint workflow so violations block PRs going forward. * Use an empty changeset (no behavior change, no release needed)
49 lines
993 B
TypeScript
49 lines
993 B
TypeScript
'use client';
|
|
|
|
import { createContext, type ReactNode, useContext } from 'react';
|
|
import type { World } from './types';
|
|
|
|
interface WorldDataContextValue {
|
|
worldId: string;
|
|
world: World;
|
|
meta: {
|
|
lastUpdated: string;
|
|
commit: string | null;
|
|
branch: string | null;
|
|
};
|
|
}
|
|
|
|
const WorldDataContext = createContext<WorldDataContextValue | null>(null);
|
|
|
|
interface WorldDataProviderProps {
|
|
worldId: string;
|
|
world: World;
|
|
meta: {
|
|
lastUpdated: string;
|
|
commit: string | null;
|
|
branch: string | null;
|
|
};
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function WorldDataProvider({
|
|
worldId,
|
|
world,
|
|
meta,
|
|
children,
|
|
}: WorldDataProviderProps) {
|
|
return (
|
|
<WorldDataContext.Provider value={{ worldId, world, meta }}>
|
|
{children}
|
|
</WorldDataContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useWorldData() {
|
|
const context = useContext(WorldDataContext);
|
|
if (!context) {
|
|
throw new Error('useWorldData must be used within a WorldDataProvider');
|
|
}
|
|
return context;
|
|
}
|