🔨 fix typing
This commit is contained in:
@@ -1,18 +1,8 @@
|
||||
import { getGithubUserContribution, Cell } from "@snk/github-user-contribution";
|
||||
import { setColor, createEmptyGrid, Color } from "@snk/compute/grid";
|
||||
import { getGithubUserContribution } from "@snk/github-user-contribution";
|
||||
import { createGif } from "@snk/gif-creator";
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { createSnake } from "@snk/compute/snake";
|
||||
|
||||
export const userContributionToGrid = (cells: Cell[]) => {
|
||||
const width = Math.max(0, ...cells.map((c) => c.x)) + 1;
|
||||
const height = Math.max(0, ...cells.map((c) => c.y)) + 1;
|
||||
|
||||
const grid = createEmptyGrid(width, height);
|
||||
for (const c of cells) if (c.k) setColor(grid, c.x, c.y, c.k as Color);
|
||||
|
||||
return grid;
|
||||
};
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { userContributionToGrid } from "./userContributionToGrid";
|
||||
|
||||
export const generateContributionSnake = async (userName: string) => {
|
||||
const { cells, colorScheme } = await getGithubUserContribution(userName);
|
||||
@@ -37,7 +27,7 @@ export const generateContributionSnake = async (userName: string) => {
|
||||
colorSnake: "purple",
|
||||
};
|
||||
|
||||
const gifOptions = { frameDuration: 10, step: 1 };
|
||||
const gifOptions = { frameDuration: 100, step: 2 };
|
||||
|
||||
const chain = getBestRoute(grid0, snake0)!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user