🚿 refactor + clean up

This commit is contained in:
platane
2020-10-20 16:53:42 +02:00
parent 2e818ce425
commit a5c9eed6cc
34 changed files with 141 additions and 250 deletions

View File

@@ -1,7 +1,7 @@
import { getGithubUserContribution } from "@snk/github-user-contribution";
import { createGif } from "@snk/gif-creator";
import { createSnake } from "@snk/compute/snake";
import { getBestRoute } from "@snk/compute/getBestRoute";
import { createSnakeFromCells } from "@snk/types/snake";
import { userContributionToGrid } from "./userContributionToGrid";
export const generateContributionSnake = async (userName: string) => {
@@ -10,7 +10,7 @@ export const generateContributionSnake = async (userName: string) => {
const grid0 = userContributionToGrid(cells);
const snake0 = createSnake([
const snake0 = createSnakeFromCells([
{ x: 4, y: -1 },
{ x: 3, y: -1 },
{ x: 2, y: -1 },
@@ -25,7 +25,7 @@ export const generateContributionSnake = async (userName: string) => {
sizeCell: 16 * upscale,
sizeDot: 12 * upscale,
colorBorder: "#1b1f230a",
colorDots: colorScheme,
colorDots: colorScheme as any,
colorEmpty: colorScheme[0],
colorSnake: "purple",
cells,

View File

@@ -1,6 +1,6 @@
import { setColor, createEmptyGrid } from "@snk/compute/grid";
import { setColor, createEmptyGrid } from "@snk/types/grid";
import type { Cell } from "@snk/github-user-contribution";
import type { Color } from "@snk/compute/grid";
import type { Color } from "@snk/types/grid";
export const userContributionToGrid = (cells: Cell[]) => {
const width = Math.max(0, ...cells.map((c) => c.x)) + 1;