# πŸ“ Separate Files System - Complete Guide ## 🎯 **Why Separate Files?** Instead of one large file, the schedule is now split into **manageable, focused files**: - βœ… **Easier to update** - Only edit what you need to change - βœ… **Less error-prone** - Smaller files are easier to work with - βœ… **Better organization** - Each file has a specific purpose - βœ… **CMS-friendly** - All files use `.txt` extension ## πŸ“‹ **File Structure** ``` πŸ“ Your Project β”œβ”€β”€ πŸ“„ schedule-september.txt ← September schedule (30 days) β”œβ”€β”€ πŸ“„ schedule-october.txt ← October schedule (12 days) β”œβ”€β”€ πŸ“„ address-mappings.txt ← Addresses for carousel cards β”œβ”€β”€ πŸ“„ time-slots.txt ← Time slot configurations β”œβ”€β”€ πŸ“„ metadata.txt ← System information └── πŸ“ modules/ ← JavaScript modules (unchanged) ``` ## πŸ”§ **How to Update Each File** ### **1. Update September Schedule** **File:** `schedule-september.txt` **Example - Change September 15th location:** ```json // Find this entry: { "date": "2025-09-15", "heading": "MΓ₯ndagskarta - Lomma Hamntorg", "url": "https://www.google.com/maps?hl=en&q=Hamntorget%2C%20Lomma%2C%20Sweden&output=embed" } // Change to: { "date": "2025-09-15", "heading": "MΓ₯ndagskarta - Ny Plats", "url": "https://www.google.com/maps?hl=en&q=Ny%20Plats%2C%20Lomma%2C%20Sweden&output=embed" } ``` ### **2. Update October Schedule** **File:** `schedule-october.txt` **Example - Add new October 15th stop:** ```json // Add this entry to the array: { "date": "2025-10-15", "heading": "Onsdagskarta - ICA Maxi MalmΓΆ", "url": "https://www.google.com/maps?hl=en&q=ICA%20Maxi%20Malm%C3%B6%2C%20Malm%C3%B6%2C%20Sweden&output=embed" } ``` ### **3. Update Address Mappings** **File:** `address-mappings.txt` **Example - Add address for new location:** ```json // Add this entry: "ICA Maxi MalmΓΆ": "MalmΓΆ, Sverige" ``` ### **4. Update Time Slots** **File:** `time-slots.txt` **Example - Add special hours for a date:** ```json // Add to specialDates array: { "date": "2025-10-15", "time": "10:00 - 16:00", "description": "Extended hours for special event" } ``` ### **5. Update Metadata** **File:** `metadata.txt` **Example - Update last modified date:** ```json // Change this: "lastUpdated": "2025-01-09" // To: "lastUpdated": "2025-01-15" ``` ## 🎯 **Common Update Scenarios** ### **Scenario 1: Change One Location in September** 1. **Edit** `schedule-september.txt` 2. **Find** the date you want to change 3. **Update** the heading and URL 4. **Save** the file 5. **Refresh** the webpage ### **Scenario 2: Add New October Stops** 1. **Edit** `schedule-october.txt` 2. **Add** new entries to the array 3. **Edit** `address-mappings.txt` 4. **Add** addresses for new locations 5. **Save** both files 6. **Refresh** the webpage ### **Scenario 3: Change Time Slots** 1. **Edit** `time-slots.txt` 2. **Modify** default times or add special dates 3. **Save** the file 4. **Refresh** the webpage ### **Scenario 4: Add No-Service Day** 1. **Edit** the appropriate month file 2. **Change** the entry to: ```json { "date": "YYYY-MM-DD", "heading": "Daykarta - Ingen vaccination", "url": "N/A" } ``` 3. **Save** the file 4. **Refresh** the webpage ## πŸ“ **File Format Guidelines** ### **Schedule Files (september.txt, october.txt)** - Must be valid JSON arrays - Each entry needs: `date`, `heading`, `url` - Date format: `"YYYY-MM-DD"` - No service: `"url": "N/A"` ### **Address Mappings (address-mappings.txt)** - Must be valid JSON object - Key: Location name (exactly as in schedule) - Value: Full address string ### **Time Slots (time-slots.txt)** - Must be valid JSON object - `defaultWeekday` and `defaultWeekend` for standard hours - `specialDates` array for exceptions ### **Metadata (metadata.txt)** - Must be valid JSON object - Contains system information and file references ## ⚠️ **Important Notes** ### **JSON Syntax Rules** - Use double quotes `"` not single quotes `'` - Commas between entries (but not after the last one) - Proper bracket matching `[]` and `{}` ### **Date Format** - Always use `YYYY-MM-DD` format - Example: `"2025-09-15"` (not `"15/09/2025"`) ### **URL Encoding** - Spaces become `%20` - Swedish characters: `Γ₯` = `%C3%A5`, `Γ€` = `%C3%A4`, `ΓΆ` = `%C3%B6` - Commas become `%2C` ### **File Dependencies** - Schedule files are independent - Address mappings must match location names exactly - Time slots apply to all schedule entries ## πŸš€ **Benefits of This System** 1. **Focused Updates** - Only edit what you need to change 2. **Smaller Files** - Easier to work with and less error-prone 3. **Better Organization** - Each file has a clear purpose 4. **CMS Friendly** - All `.txt` files work with any CMS 5. **Version Control** - Track changes to specific parts 6. **Backup Friendly** - Backup only the files you've changed ## πŸ”„ **Update Workflow** 1. **Identify** what needs to be changed 2. **Open** the relevant `.txt` file 3. **Make** your changes 4. **Validate** JSON syntax (use online JSON validator if needed) 5. **Save** the file 6. **Refresh** the webpage 7. **Test** that changes appear correctly ## πŸ› οΈ **Tools for JSON Editing** ### **Online JSON Validators** - [JSONLint](https://jsonlint.com/) - [JSON Formatter](https://jsonformatter.curiousconcept.com/) ### **Text Editors with JSON Support** - VS Code - Sublime Text - Notepad++ (with JSON plugin) ### **CMS Text Editors** - Most CMS systems have built-in text editors - Some support syntax highlighting for JSON --- **Need Help?** Check the browser console for JSON syntax errors, or use an online JSON validator to check your files.