171export const SERVER = APP_CONFIG.server;
172173export function getConfig<T = unknown>(path: string): T {
174const keys = path.split(".");
175let current: any = APP_CONFIG;
Studybeaststudybeast.tsx6 matches
136];
137138function LoginTimer({ loginTime, onExpire }: { loginTime: number; onExpire: () => void }) {
139const [timeLeft, setTimeLeft] = useState(0);
140const [progressPercent, setProgressPercent] = useState(100);
187}
188189function LoginPage({ onLogin }: { onLogin: (username: string) => void }) {
190const [username, setUsername] = useState("");
191const [password, setPassword] = useState("");
277}
278279function CourseCard({ course }: { course: Course }) {
280return (
281<div className="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
319}
320321function App() {
322const [searchTerm, setSearchTerm] = useState("");
323const [isLoggedIn, setIsLoggedIn] = useState(false);
478}
479480function client() {
481createRoot(document.getElementById("root")).render(<App />);
482}
483if (typeof document !== "undefined") { client(); }
484485export default async function server(request: Request): Promise<Response> {
486return new Response(
487`
hm-invoicesv1val-town.mdc17 matches
910- Ask clarifying questions when requirements are ambiguous
11- Provide complete, functional solutions rather than skeleton implementations
12- Test your logic against edge cases before presenting the final solution
13- Ensure all code follows Val Town's specific platform requirements
22- **Never bake in secrets into the code** - always use environment variables
23- Include comments explaining complex logic (avoid commenting obvious operations)
24- Follow modern ES6+ conventions and functional programming practices if possible
2526## Types of triggers
3334```ts
35export default async function (req: Request) {
36return new Response("Hello World");
37}
43## Val Town Standard Libraries
4445Val Town provides several hosted services and utility functions.
4647### Blob Storage
85```
8687## Val Town Utility Functions
8889Val Town provides several utility functions to help with common project tasks.
9091### Importing Utilities
168├── backend/
169│ ├── database/
170│ │ ├── queries.ts # DB query functions (CRUD operations)
171│ │ └── README.md
172│ └── routes/ # Route modules
188├── README.md
189├── config.ts # Database table names and shared config
190└── utils.ts # Shared types and functions
191```
192267268<script>
269function showResult(data, isError = false) {
270const resultDiv = document.getElementById('result');
271resultDiv.className = \`mt-6 p-4 rounded-lg \${isError ? 'bg-red-100 border border-red-300 text-red-800' : 'bg-green-100 border border-green-300 text-green-800'}\`;
274}
275276async function makeRequest(action) {
277try {
278const response = await fetch(\`?action=\${action}\`, { method: 'POST' });
284}
285286function getStatus() {
287makeRequest('status');
288}
289290function seedDatabase() {
291makeRequest('seed');
292}
293294function forceSeed() {
295makeRequest('force-seed');
296}
297298function clearDatabase() {
299if (confirm('Are you sure you want to clear all data from the database?')) {
300makeRequest('clear');
379- Main entry point should be `main.tsx`
380- **Database Setup:** Use the admin utilities to handle table creation and seeding. Backend should focus on CRUD operations only
381- **Database Queries:** Keep all query functions in `backend/database/queries.ts` with proper TypeScript typing
382- **Static asset serving:** Use the utility functions to read and serve project files:
383```ts
384import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
417- **Backend Focus:** Backend database queries should only handle CRUD operations, not table creation
418- Change table names when modifying schemas rather than altering (update in `shared/config.ts`)
419- Export clear query functions with proper TypeScript typing
420421## Common Gotchas and Solutions
583. **Backend Database Layer**
59- Create `backend/database/queries.ts` with CRUD operations
60- Implement vendor management functions
61- Implement invoice management functions
6263### Deliverables:
135- Quick status updates (click to advance status)
136- Bulk operations (select multiple invoices)
137- Search functionality
138- Sort by different columns
139164- Export invoices to CSV
165- Import invoices from CSV
166- Backup/restore functionality
167- Data validation and error messages
168199200## Deployment Strategy
201Each phase will be deployable and functional, allowing for iterative development and testing. The admin tools will be available throughout for database management and debugging.
202```
203227- Admin utilities for easy database management and seeding
228229Each phase is designed to be deployable and functional on its own, so you can test and use the system as we build it incrementally. The admin tools will be available from Phase 1, making it easy to manage your data throughout development.
230231Would you like me to start implementing Phase 1, or would you like to review/modify any part of the plan first?
api_ianmenethil_commain.tsx3 matches
9let initializationPromise: Promise<boolean> | null = null;
1011async function initializeRoutes(): Promise<boolean> {
12if (routesInitialized) {
13return true;
4849/**
50* Main server function for Val.town
51* @param request - Incoming HTTP request
52* @returns Response object
53*/
54async function server(request: Request): Promise<Response> {
55try {
56if (!routesInitialized) {
31];
3233function LoginPage() {
34const [userId, setUserId] = useState("");
35const [password, setPassword] = useState("");
176}
177178function DashboardApp() {
179const [activeSubject, setActiveSubject] = useState(null);
180232}
233234function client() {
235const path = window.location.pathname;
236if (path === "/dashboard") {
242if (typeof document !== "undefined") { client(); }
243244export default async function server(request: Request): Promise<Response> {
245// Comprehensive user credentials
246const validCredentials = {
3const KEY = Deno.env.get("NEWSAPI");
45export default async function run() {
6const q = encodeURIComponent(`Fed OR CPI OR inflation OR ECB OR RBA`);
7const url = `https://newsapi.org/v2/everything?` +
88Â `;
8990function generateHtmlShell(sourceUrl: string): string {
91return `Â
92Â <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Honeydew</title>
473Â <template id="review-task-template"><div class="review-task-item"><input type="text" class="review-task-content" placeholder="Task description" required><input type="date" class="review-task-due-date" title="Due Date"><select class="review-task-load" title="Cognitive Load"><option value="Low">Low</option><option value="Medium" selected>Medium</option><option value="High">High</option></select><button type="button" class="review-task-delete-btn" title="Remove Task">×</button></div></template>Â
474Â <script>Â
475Â (function() {
476Â const API_URL = '${sourceUrl}';Â
477Â const STORE_KEYS = { projects: 'honeydew_projects_v1', tasks: 'honeydew_tasks_v1', theme: 'honeydew_theme_v1' };Â
483Â const genId = () => Date.now().toString(36) + Math.random().toString(36).substr(2, 9);Â
484Â Â
485Â function loadState() {Â
486Â Â projects = getStore(STORE_KEYS.projects);Â
487Â Â tasks = getStore(STORE_KEYS.tasks);Â
492Â }Â
493494Â function render() {Â
495Â Â renderSidebar();Â
496Â Â renderTaskList();Â
498Â }Â
499500Â function toggleLoading(btn, show) {Â
501Â Â if (!btn) return;Â
502Â Â btn.disabled = show;Â
504Â }Â
505Â Â
506Â function updateUIElements() {Â
507Â Â const todayStr = new Date().toISOString().split("T")[0];Â
508Â Â const todayTasks = tasks.filter(t => !t.isCompleted && t.dueDate === todayStr);Â
522Â }Â
523524Â function renderSidebar() {Â
525Â Â const mainViews = [Â
526Â Â Â {id:'today',name:'Today',icon:'M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1z'},Â
531Â }Â
532533Â function renderTaskList() {Â
534Â Â const container = $("#task-list");Â
535Â Â let filteredTasks = [], title = 'Tasks';Â
561Â }Â
562563Â function renderChatLog() {Â
564Â Â const log = $("#chat-log");Â
565Â Â log.innerHTML = conversationHistory.map(msg => {Â
632Â };Â
633634function executeSingleCommand(command) {
635if (!command || !command.tool_name) return;
636if (command.tool_name === 'ask_for_confirmation') {
657}
658659function executeManualCommand(command) {
660if (Array.isArray(command)) {
661command.forEach(c => executeSingleCommand(c));
665}
666667Â async function handleChatSubmit(e) {Â
668Â Â e.preventDefault();Â
669Â Â const input = $("#chat-input"), userMessage = input.value.trim();Â
713Â }Â
714Â Â
715Â function handleAddTask(e) {Â
716Â Â e.preventDefault();Â
717Â Â const input = $("#new-task-input"), content = input.value.trim();Â
738Â }Â
739740Â function handleTaskClick(e) {Â
741Â Â const target = e.target, taskItem = target.closest(".task-item");Â
742Â Â if (!taskItem) return;Â
756Â }Â
757758Â function openEditModal(task) {Â
759Â Â $("#edit-task-id").value = task.id;Â
760Â Â $("#edit-task-content").value = task.content;Â
765Â }Â
766767Â function handleUpdateTask(e) {Â
768Â Â e.preventDefault();Â
769Â Â const taskId = $("#edit-task-id").value, task = tasks.find(t => t.id === taskId);Â
777Â }Â
778Â Â
779Â async function triggerProjectSynthesisFromButton() {Â
780Â Â const goal = prompt("Describe your new project or goal:", "Plan a launch party for a new product");Â
781Â Â if (!goal) return;Â
794Â }Â
795Â Â
796Â async function triggerDailyRebalance() {Â
797Â Â const todayStr = new Date().toISOString().split("T")[0];Â
798Â Â const todayTasks = tasks.filter(t => !t.isCompleted && t.dueDate === todayStr);Â
820Â }Â
821822Â function handleOpenChat() {Â
823Â Â const mainInput = $('#new-task-input');Â
824Â Â const text = mainInput.value.trim();Â
833Â }Â
834Â Â
835Â function addReviewTaskRow(taskData = {}) {Â
836Â Â const template = $('#review-task-template');Â
837Â Â const clone = template.content.cloneNode(true);Â
844Â }Â
845846Â function openProjectReviewModal(data) {Â
847Â Â const { projectName, tasks: aiTasks } = data;Â
848Â Â $('#review-project-name').value = projectName;Â
855Â }Â
856857Â function handleProjectReviewSubmit(e) {Â
858Â Â e.preventDefault();Â
859Â Â const projectName = $('#review-project-name').value.trim();Â
877Â }Â
878879function initTheme() {
880const themeToggle = $('#theme-toggle');
881const storedTheme = localStorage.getItem(STORE_KEYS.theme);
897}
898899Â function bindEventListeners() {Â
900Â Â document.body.addEventListener('click', e => {Â
901Â Â Â if (e.target.closest('[data-view]')) {Â
953}
954955export default async function(req: Request): Promise<Response> {
956const openai = new OpenAI();
957const url = new URL(req.url);
ChatEnhancedCommandPalette.tsx2 matches
58}
5960// Helper functions for JSON Schema handling
61const getDefaultValue = (schema: any): any => {
62if (schema.default !== undefined) return schema.default;
138};
139140export default function EnhancedCommandPalette({
141servers,
142query,
fart-with-aiindex.html2 matches
261const soundWaves = document.getElementById('soundWaves');
262263function createSoundWave() {
264const wave = document.createElement('div');
265wave.className = 'wave';
271}
272273function createStinkCloud() {
274const cloud = document.createElement('div');
275cloud.className = 'cloud';