import { Controller } from "@hotwired/stimulus"
import { DirectUpload } from "@rails/activestorage"
export default class extends Controller {
static targets = ["input", "preview", "status"]
static values = {
export interface UseClipboardResult {
copied: boolean;
error: Error | null;
copy: (value: string) => Promise<boolean>;
}
class PostsController < ApplicationController
def create
@post = current_user.posts.build(post_params)
if @post.save
flash[:success] = 'Post was successfully created.'
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["field"]
connect() {
.confirm-dialog {
border: none;
border-radius: 12px;
padding: 1.5rem;
max-width: 26rem;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
import { z } from "zod";
export const signupSchema = z
.object({
email: z.string().min(1, "Email is required").email("Enter a valid email"),
username: z
<%= turbo_frame_tag 'modal' %>
export const required = (msg = 'This field is required') => (value) =>
value && value.trim() !== '' ? '' : msg;
export const minLength = (n, msg) => (value) =>
value && value.length >= n ? '' : msg || `Must be at least ${n} characters`;
import { CanDeactivateFn } from '@angular/router';
import { Observable } from 'rxjs';
export interface HasUnsavedChanges {
canDeactivate(): boolean | Observable<boolean>;
}
import React from 'react'
interface SkeletonProps {
width?: string | number
height?: string | number
className?: string
import UIKit
class HapticFeedbackManager {
static let shared = HapticFeedbackManager()
private let impactLight = UIImpactFeedbackGenerator(style: .light)
export interface Page<T> {
items: T[];
nextCursor: string | null;
}
export interface Post {