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 { useState, useEffect, useCallback, useRef } from "react"; | |
/** | |
* Return type for useLocalStorage hook | |
* @template T - The type of the stored value | |
*/ | |
export interface UseLocalStorageReturn<T> { | |
/** Current value from localStorage */ | |
value: T; | |
/** Set new value to localStorage */ |
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 { NextResponse } from "next/server"; | |
import NextAuth from "next-auth"; | |
import { authConfig } from "./server/auth/config"; | |
import { menuItems } from "./lib/config/menu-items"; | |
const { auth } = NextAuth(authConfig); | |
export default auth((req) => { | |
const session = req.auth; |
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
export interface QrisSettings { | |
/** Payment amount (as string number) */ | |
nominal: string; | |
/** Service fee type: 'p' for percentage, 'r' for fixed value (rupiah) */ | |
feeType?: "p" | "r"; | |
/** Service fee value (as string number) */ | |
feeValue?: string; | |
} | |
function padLength(length: number): 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
"use server"; | |
import { v2 as cloudinary } from "cloudinary"; | |
import fs from "fs/promises"; | |
import path from "path"; | |
cloudinary.config({ | |
cloud_name: process.env.CLOUDINARY_CLOUD_NAME!, | |
api_key: process.env.CLOUDINARY_API_KEY!, | |
api_secret: process.env.CLOUDINARY_API_SECRET!, |
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 { createRoot } from "react-dom/client"; | |
import { | |
AlertDialog, | |
AlertDialogAction, | |
AlertDialogCancel, | |
AlertDialogContent, | |
AlertDialogDescription, | |
AlertDialogFooter, | |
AlertDialogHeader, |
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
"use client"; | |
import { Button } from "@/components/ui/button"; | |
import { useEffect, useState } from "react"; | |
import { | |
ChevronFirst, | |
ChevronLast, | |
ChevronLeft, | |
ChevronRight, | |
} from "lucide-react"; |
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 GoogleClient from "./googleClient"; | |
import { drive_v3 } from "googleapis"; | |
/** | |
* A service for interacting with Google Drive API. | |
*/ | |
export class DriveService { | |
/** | |
* @private | |
* @type {GoogleClient} |
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
{ | |
"about": { | |
"browser": "chrome", | |
"version": "20.4.1" | |
}, | |
"showall": true, | |
"lang": "en", | |
"dark": "enable", | |
"favicon": "🔆", | |
"tabtitle": "New Tab", |
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
export function generatePassword( | |
length: number = 8, | |
includeUppercase: boolean = true, | |
includeLowercase: boolean = true, | |
includeNumbers: boolean = true, | |
includeSymbols: boolean = true | |
): string { | |
const uppercaseCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
const lowercaseCharset = "abcdefghijklmnopqrstuvwxyz"; | |
const numberCharset = "0123456789"; |
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
export function abbreviateName(name) { | |
let parts = name.split(' '); | |
// Make 2-letter sentences uncountable | |
let combinedParts = []; | |
for (let i = 0; i < parts.length; i++) { | |
if (parts[i].length <= 2 && i < parts.length - 1) { | |
combinedParts.push(parts[i] + ' ' + parts[i + 1]); | |
i++; // Skip 2-letter part | |
} else { |