judgeWordsmain.tsx4 matches
7} from "https://esm.sh/react@18.2.0";
89function NamePrompt({ onSubmit }) {
10const [name, setName] = useState("");
11const [error, setError] = useState("");
38}
3940function App() {
41const [cards, setCards] = useState([]);
42const [currentCardIndex, setCurrentCardIndex] = useState(0);
217}
218219function client() {
220createRoot(document.getElementById("root")).render(<App />);
221}
222if (typeof document !== "undefined") client();
223224export default async function server(request: Request): Promise<Response> {
225const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
226
512513// Fetch data from API
514async function fetchInstanceData() {
515try {
516const response = await fetch(API_URL);
527528// Render the instance data to the page with tabs
529function render(data) {
530const container = document.getElementById('instance-container');
531container.innerHTML = '';
641642// Switch between tabs
643function switchTab(expansionName) {
644// Update tab buttons
645document.querySelectorAll('.tab-button').forEach(button => {
659660// Save state to localStorage
661function saveState() {
662const stateObject = {};
663const checkboxes = document.querySelectorAll('input[type="checkbox"][data-instance-id]');
678679// Load state from localStorage
680function loadState() {
681try {
682const savedState = localStorage.getItem('ffxivCompletionState');
704}
705706// Search functionality
707function setupSearch() {
708const searchBar = document.getElementById('search-bar');
709
730731// Event listeners
732function setupEventListeners() {
733const container = document.getElementById('instance-container');
734
774775// Update custom checkbox visual state
776function updateCustomCheckbox(checkbox) {
777const label = checkbox.closest('.checkbox-label');
778const customCheckbox = label.querySelector('.custom-checkbox');
783784// Handle row selection
785function handleRowSelection(checkbox) {
786const instanceId = checkbox.dataset.instanceId;
787const row = checkbox.closest('.instance-row');
799800// Update selection toolbar visibility and count
801function updateSelectionToolbar() {
802const toolbar = document.getElementById('selection-toolbar');
803const countSpan = document.getElementById('selection-count');
814815// Initialize
816async function init() {
817console.log('Initializing FFXIV Completion Tracker...');
818
839840// Selection-based bulk actions
841function markSelectedAsUnlocked() {
842selectedRows.forEach(instanceId => {
843const checkbox = document.querySelector(\`input[data-instance-id="\${instanceId}"][data-type="unlocked"]\`);
850}
851852function markSelectedAsCompleted() {
853selectedRows.forEach(instanceId => {
854const checkbox = document.querySelector(\`input[data-instance-id="\${instanceId}"][data-type="completed"]\`);
861}
862863function clearSelectedProgress() {
864selectedRows.forEach(instanceId => {
865const unlockedCheckbox = document.querySelector(\`input[data-instance-id="\${instanceId}"][data-type="unlocked"]\`);
878}
879880function clearSelection() {
881// Clear all selected rows
882document.querySelectorAll('.row-selector:checked').forEach(checkbox => {
897</html>`;
898899// Helper function to convert text to APA title case
900function toTitleCase(str: string): string {
901// APA style - lowercase articles, prepositions, and conjunctions unless they're first/last words
902const minorWords = ['a', 'an', 'and', 'as', 'at', 'but', 'by', 'for', 'if', 'in', 'into', 'is', 'it', 'nor', 'of', 'on', 'or', 'so', 'the', 'to', 'up', 'yet'];
920}
921922// Helper function to make content type singular
923function makeSingular(contentType: string): string {
924const singularMap: Record<string, string> = {
925'Dungeons': 'Dungeon',
943944// Fetch FFXIV instance data from XIVAPI
945async function fetchFFXIVData() {
946const allInstances: any[] = [];
947const baseUrl = 'https://xivapi.com/instancecontent?columns=ID,Name,ContentType.Name,ContentFinderCondition.Name,ContentFinderCondition.ClassJobLevelRequired,UnlockQuest.Name';
11881189// API handler for instance data
1190async function handleInstanceAPI(): Promise<Response> {
1191const corsHeaders = {
1192'Access-Control-Allow-Origin': '*',
12361237// Request handler
1238async function handler(request: Request): Promise<Response> {
1239const url = new URL(request.url);
1240
20Note on Pagination: XIVAPI results are paginated (e.g., 100 results per page). Your script must loop through all pages to collect every instance.
2122Task 1.2: Create the Val Town "Val" (Function).
2324Create a new val in your Val Town workspace (e.g., ffxivInstanceList).
88Task 3.1: Fetch and Render Data.
8990In script.js, write an async function to fetch data from your Val Town URL.
9192Once you have the JSON data, write a render(data) function.
9394This function will:
9596Get the <main id="instance-container"> element.
106Task 3.2: Implement State Persistence.
107108Saving: Create a saveState() function. This function will find all checkboxes on the page, loop through them, and build a JSON object like { "instance_id_123": { unlocked: true, completed: false }, ... }. It will then save this object to localStorage.setItem('ffxivCompletionState', JSON.stringify(stateObject)).
109110Loading: Create a loadState() function. This function will get the item from localStorage, parse it, and then loop through the rendered checkboxes on the page, setting their checked property to true or false based on the loaded data.
111112Binding: Call loadState() after you first render the list. Add an event listener to the main instance-container that listens for change events on the checkboxes. When an event occurs, call saveState().
116Add an input event listener to the #search-bar.
117118Inside the listener function, get the search bar's current value (and convert to lowercase).
119120Get all the .instance-row elements.
124If it matches, set row.style.display = ''. If not, set row.style.display = 'none'.
125126At the end of this phase, your application will be fully functional on Val town.
127128// July 20 2025 //
814// --- AI SYSTEM PROMPTS ---
815const PROMPT_REFINER_SYSTEM_PROMPT =
816`You operate as a specialized prompt engineer to generate {{variable}} meta prompts. Your function is to transmute raw, structured occupational data into an elaborate, efficacious, and long-form directive for a target AI. You will be given an "Occupation," "Task," and ancillary data fields. Your generated prompts must be comprehensive, detailed, and structured as a professional brief, suitable for guiding an advanced AI agent.
817818# Core Rule
819This is the most critical mandate of your function. YOU MUST RETURN A PROMPT THAT HAS {{variables}} IN IT!! Your purpose is not to create a static prompt, but a reusable **template**. Your primary goal is to identify the most important, undefined, or abstract entities and concepts within the user's \`Task\` description and convert them all into descriptive, double-curly-braced {{placeholders}} or {{variables}} . You MUST include at least 2 placeholder variables in your response. For example, if the task is "Analyze data on market conditions to identify potential sales of a product or service," the key undefined entity is "a product or service," which you MUST turn into a placeholder like \`{{product_or_service}}\`. Other examples include specific documents ("a report" -> \`{{report_topic}}\`), timeframes ("in the coming quarter" -> \`{{target_quarter}}\`), or clients ("for the client" -> \`{{client_name}}\`). A generated prompt template that fails to create appropriate \`{{placeholders}}\` for all such undefined entities is considered a failure. You must always create at least one.
820821# Instructions
898899// --- FRONTEND ---
900function generateHtml(sourceUrl: string) {
901return `
902<!DOCTYPE html>
1020let formFieldsState = [];
10211022function renderLatexDocument(latexSource, targetElement) {
1023if (!latexSource || !targetElement) return;
1024
agent-examplemain.tsx1 match
6import { DynamicTool } from 'npm:@langchain/core/tools'
78export async function agentExample() {
910const llm = new OpenAI()
url-projectserver.tsx1 match
9} from "./backend/database/queries.ts";
1011export default async function(request: Request) {
12const url = new URL(request.url);
13const path = url.pathname;
url-projectREADME.md1 match
3This directory contains code that is shared between the frontend and backend.
45- `utils.ts` - Utility functions and shared types
url-projectlayout.tsx1 match
3import { type loader } from "./layout.server.ts";
45export default function Layout() {
6let data = useLoaderData<typeof loader>();
7
url-projectlayout.server.ts3 matches
1import { ActionFunctionArgs, type LoaderFunctionArgs } from "npm:react-router";
23let db = { message: "Hello world!" };
45export async function loader(args: LoaderFunctionArgs) {
6await new Promise(resolve => setTimeout(resolve, 200));
7return { message: db.message };
8}
910export async function action({ request }: ActionFunctionArgs) {
11let formData = await request.formData();
12db.message = String(formData.get("message"));
url-projectlayout.client.ts3 matches
1import { type LoaderFunctionArgs } from "npm:react-router";
23export async function loader({ request }: LoaderFunctionArgs) {
4let url = new URL(request.url);
5let res = await fetch(url, {
12}
1314export async function action({ request }: LoaderFunctionArgs) {
15let url = new URL(request.url);
16// call the server action