This file contains 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 { z } from "zod"; | |
export type Locale = z.input<typeof localeSchema>; | |
const localeSchema = z.object({ | |
name: z.string(), | |
path: z.string(), | |
default: z.boolean().optional(), | |
dir: z.enum(["ltr", "rtl"]).optional().default("ltr"), | |
metadata: z.record(z.unknown()).optional().default({}), |
This file contains 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 { useFetcher } from "@remix-run/react"; | |
import { Control, Field, Message, Root, Submit } from "@radix-ui/react-form"; | |
import { useEffect, useState } from "react"; | |
import { type DataFunctionArgs } from "@remix-run/node"; | |
export default function Testing() { | |
const { Form, data } = useFetcher<typeof action>(); | |
const [error, setError] = useState(false); | |
useEffect(() => { |
This file contains 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
{% comment %} | |
Lazily importing css stylesheets, without blocking the document download. | |
Accepts: | |
- sheets: `string` of the css files seperated by `,`. | |
Usage: | |
{% render 'stylesheet-import', sheets: 'component.css,not-component.css' %} | |
{% endcomment %} |
This file contains 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
// 1. copy and paste this in a remix project base directory. | |
// 2. run `node routes_gen.mjs <optional routes folder default to "./app/routes"> <optional output file default to "./app/routes.ts">` | |
// 3. you get a cool string[] of all the routes ids in a file inside your project | |
import fs from "fs"; | |
import path from "path"; | |
const routesFolder = process.argv[2] || "./app/routes/"; | |
const outputFile = process.argv[3] || "./app/routes.ts"; |
This file contains 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 { sql } from "@vercel/postgres"; | |
import { drizzle } from "drizzle-orm/vercel-postgres"; | |
import { migrate } from "drizzle-orm/vercel-postgres/migrator"; | |
import "dotenv/config"; | |
async function runMigrate() { | |
if (!process.env.POSTGRES_DATABASE) { | |
throw new Error("POSTGRES_DATABASE is not defined"); | |
} |