flashcard
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v65View latest version
This directory contains the client-side code for the Flashcard Learning App.
- index.html - Single-page application with all views and layouts
- index.js - Client-side JavaScript for UI logic and API calls
The app uses a view-based navigation system where views are shown/hidden:
- Login View - Username entry
- Deck List View - Dashboard showing all decks
- Deck Editor View - Create/edit deck form
- Card Manager View - List and manage cards in a deck
- Study View - Spaced repetition study session
- Statistics View - Performance metrics and history
- Backup View - Data export/import
CSS 3D transforms create realistic card flipping effect:
- Front shows question
- Back shows answer
- Smooth 0.6s transition
Real-time timer tracks session duration:
- Updates every second
- Displays as MM:SS format
- Stops when session ends
Username stored in sessionStorage for auto-login on page reload.
Global state variables in index.js:
currentUser- Logged-in usernameuserData- Full user data objectcurrentDeckId- Active deck being viewed/studiedstudyCards- Cards in current study sessionsessionStartTime- Study session start timesessionCorrectCount- Correct answers counter
All API calls use the apiCall() wrapper:
- Adds
X-Usernameheader automatically - Handles JSON parsing
- Provides error handling with user feedback
- TailwindCSS via CDN for utility-first styling
- Custom CSS for card flip animations
- Responsive design works on mobile and desktop
- Add HTML in
index.html(or create new view) - Add JavaScript logic in
index.js - Connect event listeners in DOMContentLoaded
- Style with TailwindCSS classes