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
| version: "3.7" | |
| services: | |
| pocketbase: | |
| image: ghcr.io/muchobien/pocketbase:latest | |
| container_name: pocketbase | |
| restart: unless-stopped | |
| command: | |
| - --encryptionEnv | |
| - ENCRYPTION | |
| environment: |
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 { useCallback, useEffect, useRef } from "react"; | |
| export function useLongPress({ | |
| delay, | |
| onLongPress, | |
| onClick, | |
| onCancel, | |
| onFinish, | |
| onStart, | |
| }: { |
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 { useCallback, useEffect, useRef, useState } from "react"; | |
| /** | |
| * Custom React hook for double-click confirmation for critical actions. | |
| * | |
| * @param action - The action to be executed on the second click. | |
| * @param timeout - Time in milliseconds to reset the unlocked state. | |
| * @returns The current unlocked state and the trigger function. | |
| */ | |
| const useConfirmation = (action: () => void, timeout: number = 5000) => { |
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 { useCallback, useEffect, useState } from "react"; | |
| type FetchState<T> = { | |
| data: T | null; | |
| isLoading: boolean; | |
| error: Error | null; | |
| isCached: boolean; | |
| refetch: () => void; | |
| }; |
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 { useEffect, useState } from "react"; | |
| import resolveConfig from "tailwindcss/resolveConfig"; | |
| // Update the path to your Tailwind config file | |
| import tailwindConfig from "tailwind.config"; | |
| const useTailwindBreakpoint = ({ | |
| onBreakpointChange, | |
| }: { | |
| // eslint-disable-next-line no-unused-vars |
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
| /** | |
| * Custom hook for dynamically resizing a textarea to fit its content. | |
| * @param {React.RefObject<HTMLTextAreaElement>} textareaRef - Reference to the textarea element. | |
| * @param {string} textContent - Current text content of the textarea. | |
| * @param {number} maxHeight - Optional: maxHeight of the textarea in pixels. | |
| */ | |
| import { useEffect } from "react"; | |
| const useDynamicTextareaSize = ( | |
| textareaRef: React.RefObject<HTMLTextAreaElement>, |
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 { useCallback, useState } from "react"; | |
| // Custom hook to copy text to clipboard | |
| const useCopyToClipboard = (timeoutDuration: number = 1000) => { | |
| const [copied, setCopied] = useState(false); | |
| const [error, setError] = useState<Error | null>(null); | |
| const copyToClipboard = useCallback( | |
| async (text: string) => { | |
| try { |
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 { useEffect, useState } from "react"; | |
| function useLocalStorage() { | |
| const [loadingStates, setLoadingStates] = useState<Map<string, boolean>>( | |
| new Map() | |
| ); | |
| const setStorageValue = <T>(key: string, value: T) => { | |
| try { | |
| window.localStorage.setItem(key, JSON.stringify(value)); |
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 { useEffect, useState } from "react"; | |
| interface LocationOptions { | |
| enableHighAccuracy?: boolean; | |
| timeout?: number; | |
| maximumAge?: number; | |
| } | |
| interface LocationState { | |
| coords: { |
OlderNewer