untitled-7712README.md2 matches
5## Structure
67- `utils.ts` - Shared utility functions and TypeScript interfaces
89## Shared Types
13- `Message` - Chat message data structure
1415## Utility Functions
1617- `formatDate` - Format dates for display
untitled-7712README.md1 match
8- `database/` - Database setup and queries
9- `migrations.ts` - Database schema definitions
10- `queries.ts` - Database query functions
1112## API Endpoints
untitled-7712index.js19 matches
3435// Initialize app
36function init() {
37// Check for logged in user
38const savedUser = localStorage.getItem('jobBoardUser');
5859// Event listeners
60function setupEventListeners() {
61// Login form
62elements.loginForm.addEventListener('submit', handleLogin);
8283// API calls
84async function fetchJobs() {
85try {
86const response = await fetch('/api/jobs');
95}
9697async function fetchMessages(limit = 50) {
98try {
99const response = await fetch(`/api/messages?limit=${limit}`);
115}
116117async function createUser(username) {
118try {
119const response = await fetch('/api/users', {
134}
135136async function createJob(jobData) {
137try {
138const response = await fetch('/api/jobs', {
153}
154155async function sendMessage(content) {
156try {
157const response = await fetch('/api/messages', {
178179// Event handlers
180async function handleLogin(e) {
181e.preventDefault();
182
198}
199200function handleLogout() {
201state.user = null;
202localStorage.removeItem('jobBoardUser');
204}
205206async function handleJobSubmit(e) {
207e.preventDefault();
208
234}
235236async function handleChatSubmit(e) {
237e.preventDefault();
238
254255// UI Rendering
256function showLoginScreen() {
257elements.loginScreen.classList.remove('hidden');
258elements.app.classList.add('hidden');
259}
260261function showApp() {
262elements.loginScreen.classList.add('hidden');
263elements.app.classList.remove('hidden');
265}
266267function renderJobs() {
268if (state.jobs.length === 0) {
269elements.jobsContainer.innerHTML = '<p class="text-gray-500 text-center py-4">No jobs posted yet. Be the first!</p>';
294}
295296function showJobDetails(jobId) {
297const job = state.jobs.find(j => j.id === jobId);
298if (!job) return;
330}
331332function renderMessages() {
333if (state.messages.length === 0) {
334elements.chatMessages.innerHTML = '<p class="text-gray-500 text-center py-4">No messages yet. Start the conversation!</p>';
357}
358359// Utility functions
360function toggleModal(modal, show) {
361if (show) {
362modal.classList.remove('hidden');
366}
367368function showError(element, message) {
369element.textContent = message;
370element.classList.remove('hidden');
untitled-7712utils.ts3 matches
2526// Format date for display
27export function formatDate(dateString: string): string {
28const date = new Date(dateString);
29return date.toLocaleString();
3132// Sanitize HTML to prevent XSS
33export function sanitizeHTML(str: string): string {
34return str
35.replace(/&/g, '&')
4142// Validate email format
43export function isValidEmail(email: string): boolean {
44const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
45return emailRegex.test(email);
untitled-7712queries.ts7 matches
3738// User queries
39export async function getUsers(): Promise<User[]> {
40const result = await sqlite.execute(`SELECT * FROM ${USERS_TABLE} ORDER BY created_at DESC`);
41return result.rows as User[];
42}
4344export async function getUserByUsername(username: string): Promise<User | null> {
45const result = await sqlite.execute(
46`SELECT * FROM ${USERS_TABLE} WHERE username = ?`,
50}
5152export async function createUser(username: string): Promise<User> {
53const result = await sqlite.execute(
54`INSERT INTO ${USERS_TABLE} (username) VALUES (?) RETURNING *`,
5960// Job queries
61export async function getJobs(): Promise<Job[]> {
62const result = await sqlite.execute(`SELECT * FROM ${JOBS_TABLE} ORDER BY created_at DESC`);
63return result.rows as Job[];
64}
6566export async function createJob(job: JobInput): Promise<Job> {
67const result = await sqlite.execute(
68`INSERT INTO ${JOBS_TABLE} (title, company, description, location, contact_email, posted_by)
7475// Message queries
76export async function getMessages(limit: number = 50): Promise<Message[]> {
77const result = await sqlite.execute(
78`SELECT * FROM ${MESSAGES_TABLE} ORDER BY created_at DESC LIMIT ?`,
82}
8384export async function createMessage(content: string, username: string): Promise<Message> {
85const result = await sqlite.execute(
86`INSERT INTO ${MESSAGES_TABLE} (content, username) VALUES (?, ?) RETURNING *`,
untitled-7712migrations.ts1 match
6const MESSAGES_TABLE = "job_board_messages";
78export async function initDatabase() {
9// Create users table
10await sqlite.execute(`
pass-genpassword-generator.ts17 matches
1export default async function (req: Request) {
2// Fetch a password from dinopass.com on the server side to avoid CORS issues
3let dinoPassword = "";
130]);
131
132// Function to check if a string is a known word
133function isKnownWord(word) {
134return allWords.has(word.toLowerCase());
135}
136
137// Function to check if a string ends with a known adjective ending in 'y'
138function endsWithAdjectiveY(str) {
139str = str.toLowerCase();
140return wordDictionary.adjectivesY.some(adj => str.endsWith(adj));
141}
142
143// Function to check if a string contains a color word
144function containsColorWord(str) {
145str = str.toLowerCase();
146return wordDictionary.colors.some(color => str.includes(color));
147}
148
149// Function to check if a string contains an animal word
150function containsAnimalWord(str) {
151str = str.toLowerCase();
152return wordDictionary.animals.some(animal => str.includes(animal));
153}
154
155// Function to extract whole words from dinopass response
156function extractWords(password) {
157// Remove any numbers or special characters
158const cleanPassword = password.replace(/[^a-zA-Z]/g, '').toLowerCase();
232}
233
234// Function to capitalize first letter
235function capitalize(word) {
236return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
237}
238
239// Function to generate password
240async function generatePassword() {
241try {
242// Show loading state
271}
272
273// Function to copy password to clipboard
274function copyToClipboard() {
275const passwordField = document.getElementById('passwordField');
276if (!passwordField.value) return;
9- Extracts whole words from the dinopass response
10- Capitalizes the first letter of each word
11- Modern UI with a copy-to-clipboard function
12- Responsive design that works on all devices
13
untitled-2444index.ts14 matches
4748// Set up the form submission handler
49function setupFormHandling(
50tokenizer: Tokenizer,
51scriptEditor: ScriptEditor,
264265// Set up the token counter
266function setupTokenCounter(tokenizer: Tokenizer) {
267const textArea = document.getElementById("text") as HTMLTextAreaElement;
268const tokenCount = document.getElementById("tokenCount") as HTMLSpanElement;
296297// Set up template selector
298function setupTemplateSelector(templateManager: TemplateManager) {
299const templateSelect = document.getElementById("templateSelect") as HTMLSelectElement;
300const instructionsTextarea = document.getElementById("instructions") as HTMLTextAreaElement;
314315// Set up advanced options
316function setupAdvancedOptions(openAIConnector: OpenAIConnector, debugConsole: DebugConsole) {
317const advancedOptionsBtn = document.getElementById("advancedOptionsBtn") as HTMLButtonElement;
318const advancedOptions = document.getElementById("advancedOptions") as HTMLDivElement;
417418// Set up result actions (copy, download, compare)
419function setupResultActions(scriptEditor: ScriptEditor, textFormatter: TextFormatter) {
420const copyBtn = document.getElementById("copyBtn") as HTMLButtonElement;
421const downloadBtn = document.getElementById("downloadBtn") as HTMLButtonElement;
604605// Set up history modal
606function setupHistoryModal(historyManager: HistoryManager, scriptEditor: ScriptEditor) {
607const historyBtn = document.getElementById("historyBtn") as HTMLButtonElement;
608const historyModal = document.getElementById("historyModal") as HTMLDivElement;
674675// Set up utility buttons (load sample, clear)
676function setupUtilityButtons(scriptEditor: ScriptEditor) {
677const loadSampleBtn = document.getElementById("loadSampleBtn") as HTMLButtonElement;
678const clearBtn = document.getElementById("clearBtn") as HTMLButtonElement;
704705// Set up script type detection
706function setupScriptTypeDetection(tokenizer: Tokenizer) {
707const textArea = document.getElementById("text") as HTMLTextAreaElement;
708const scriptTypeDetected = document.getElementById("scriptTypeDetected") as HTMLSpanElement;
757/**
758* Create a prompt based on script type
759* This is a duplicate of the server-side function to enable direct API calls
760*/
761function createPromptForScriptType(
762chunk: string,
763instructions: string,
859860// Set up word counter
861function setupWordCounter(textFormatter: TextFormatter) {
862const textArea = document.getElementById("text") as HTMLTextAreaElement;
863const wordCount = document.getElementById("wordCount") as HTMLSpanElement;
879880// Set up share modal
881function setupShareModal() {
882const shareModal = document.getElementById("shareModal") as HTMLDivElement;
883const closeShareBtn = document.getElementById("closeShareBtn") as HTMLButtonElement;
955956// Set up feedback modal
957function setupFeedbackModal() {
958const feedbackModal = document.getElementById("feedbackModal") as HTMLDivElement;
959const closeFeedbackBtn = document.getElementById("closeFeedbackBtn") as HTMLButtonElement;
10231024// Set up export/import settings
1025function setupExportImportSettings() {
1026const exportSettingsBtn = document.getElementById("exportSettingsBtn") as HTMLButtonElement;
1027const importSettingsBtn = document.getElementById("importSettingsBtn") as HTMLButtonElement;
42import { Drawer } from "https://esm.sh/vaul?deps=react@18.2.0,react-dom@18.2.0";
4344function SideDrawer({ trigger, title, content, initialOpen = false }: {
45trigger: React.JSX.Element;
46title: string;
74}
7576function BottomDrawer({ trigger, title, content, initialOpen = false }: {
77trigger: React.JSX.Element;
78title: string;
279};
280281function ProductCard(
282{ db, cart, product, activeProductId, setActiveProductId }: {
283db: any;
439}
440441function ProductCarousel({ children }: { children: React.ReactNode }) {
442const [emblaRef, emblaApi] = useEmblaCarousel({
443axis: "x",
470const scrollResult = emblaApi.scrollTo(emblaApi.selectedScrollSnap() + Math.sign(delta));
471472if (scrollResult && typeof scrollResult.then === "function") {
473scrollResult.then(() => {
474isScrollingRef.current = false;
10921093// Client-side rendering
1094function client() {
1095const root = document.getElementById("root");
1096if (root) {
1111const app = new Hono();
11121113// Server-side rendering function
1114const renderPage = () => {
1115const content = renderToString(