yarn create vite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type CacheMetadata = { | |
| createdTime: number | |
| maxAge: number | null | |
| expires: number | null | |
| } | |
| function shouldRefresh(metadata: CacheMetadata) { | |
| if (metadata.maxAge) { | |
| return Date.now() > metadata.createdTime + metadata.maxAge | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as bcrypt from "bcrypt"; | |
| import { createCookieSessionStorage, redirect } from "remix"; | |
| import { db } from "./db.server"; | |
| export type LoginForm = { | |
| username: string; | |
| password: string; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Cell({ | |
| value, | |
| row: {values: user}, | |
| column: {id: propertyName}, | |
| }: { | |
| value: string | |
| row: {values: User} | |
| column: {id: string} | |
| }) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react' | |
| import {useLocation} from 'react-router-dom' | |
| import {useTransition} from '@remix-run/react' | |
| import {useBeforeUnload} from 'remix' | |
| import {useSSRLayoutEffect} from './misc' | |
| let firstRender = true | |
| let positions: {[key: string]: number} = {} | |
| const SESSION_STORAGE_KEY = 'kody_scroll_positions' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { Link } from "react-router-dom"; | |
| export function createResource(getPromise) { | |
| let cache = {}; | |
| let inflight = {}; | |
| let errors = {}; | |
| function load(key) { | |
| inflight[key] = getPromise(key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Machine, assign } from "xstate"; | |
| import firebase from "./firebase"; | |
| const chart = { | |
| id: "auth", | |
| context: { | |
| auth: null, | |
| error: null, | |
| loggedoutTime: null | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { renderToNodeStream } from "react-dom/server"; | |
| import Remix, { loadRouteData } from "remix/RemixNode"; | |
| // same App as entry-web! | |
| import App from "./App"; | |
| export default async (req, res, assets, matches) => { | |
| // @remix-run/firebase is calling this function and passing | |
| // the arguments in, @remix-run/aws or @remix-run/azure will | |
| // pass in whatever APIs those platforms use | |
| // you have total control over the server rendering, here we |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { Meta, Scripts, Styles, Routes } from "@remix-run/react"; | |
| import { useLocation } from "react-router-dom"; | |
| let noScriptPaths = new Set(["/", "/buy", "/logout", "/features", "/privacy"]); | |
| export default function App() { | |
| let location = useLocation() | |
| let includeScripts = !noScriptPaths.has(location.pathname); | |
| let { lang }= useLocalization() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { Action, Loader } from "@remix-run/loader"; | |
| import { json, parseFormBody, redirect } from "@remix-run/loader"; | |
| import { readTodos, createTodo, deleteTodo } from "../data/todo"; | |
| let action: Action = async ({ request, context: { session } }) => { | |
| let [method, body] = await methodOverride(request); | |
| await new Promise((res) => setTimeout(res, 1000)); | |
| switch (method) { | |
| case "post": { | |
| let [_, error] = await createTodo(body!.name); |