import { useState, useEffect } from 'react'
export function useDebounce<T>(value: T, delay: number = 500): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value)
useEffect(() => {
import { createConsumer, Cable } from '@rails/actioncable'
let cable: Cable | null = null
export function getCable(): Cable {
if (!cable) {
import { useState, useMemo, useCallback } from 'react'
import { Post } from '@/types'
import { PostCard } from './PostCard'
interface FilteredPostsProps {
posts: Post[]
import { useEffect, useState, useRef } from 'react'
interface UseInViewOptions {
threshold?: number | number[]
rootMargin?: string
triggerOnce?: boolean
import { useReducer } from 'react'
interface FormState {
values: Record<string, any>
errors: Record<string, string>
touched: Record<string, boolean>
import { useState, useRef } from 'react'
import { DirectUpload } from '@rails/activestorage'
interface ImageUploadProps {
onUploadComplete: (blobId: string) => void
maxSize?: number
export type EventMap = Record<string, unknown[]>;
type Listener<Args extends unknown[]> = (...args: Args) => void;
export class TypedEmitter<Events extends EventMap> {
private listeners = new Map<keyof Events, Set<Listener<any>>>();
import { useCallback, useEffect, useRef, useState } from 'react';
export type CopyStatus = 'idle' | 'copied' | 'error';
function fallbackCopy(text: string): boolean {
const textarea = document.createElement('textarea');
import { Response } from 'express';
type Client = { id: number; res: Response };
const clients = new Map<string, Set<Client>>();
let nextId = 1;
<template>
<form @submit.prevent="form.post(route('posts.store'))">
<div>
<label>Title</label>
<input v-model="form.title" type="text" />
<div v-if="form.errors.title">{{ form.errors.title }}</div>
import { lazy, Suspense } from 'react'
import { BrowserRouter, Routes, Route } from 'react-router-dom'
import Layout from '@/components/Layout'
// Eager load critical routes
import Home from '@/pages/Home'
import * as Sentry from "@sentry/react";
const environment = import.meta.env.VITE_ENVIRONMENT ?? "development";
const isProd = environment === "production";
export function initSentry(): void {