Files
dkala-api/dump/README_icons.md
T

59 lines
2.3 KiB
Markdown

# Icon Naming Process
## Files Created:
- `icons.csv` - Updated with "icon_name" column
- `icon_viewer.html` - Web interface to view and name icons
- `populate_icon_names.js` - Script to add names to CSV
## Step-by-Step Process:
### 1. View the Icons
- Open `icon_viewer.html` in your web browser
- You'll see all 138 icons in a grid layout
- Each icon shows its number and has an input field for naming
### 2. Name the Icons
- Look at each icon and enter appropriate names in the input fields
- The progress counter shows how many you've named
- Names should be descriptive (e.g., "hamburger", "pizza", "coffee", "delivery")
### 3. Export Named Icons (Optional)
- Click "Export Named Icons" to download a CSV of only the named icons
- This helps you review your naming before finalizing
### 4. Update the Main CSV
- Edit `populate_icon_names.js`
- Replace the placeholder names in the `iconNames` array with your actual names
- Run the script: `node populate_icon_names.js`
## Example Icon Names:
- Food items: "pizza", "burger", "pasta", "salad"
- Drinks: "coffee", "soda", "juice", "beer"
- Categories: "fast_food", "italian", "asian", "desserts"
- Actions: "delivery", "pickup", "favorite", "cart"
## Tips:
- Use consistent naming conventions (snake_case or camelCase)
- Keep names short but descriptive
- Group similar icons with consistent prefixes if applicable
- Review all names before running the populate script
The final CSV will have all original columns plus the new "icon_name" column with your custom names.
---
## Import named icons into the database
To insert icons from `named_icons.csv` into the `icons` table:
1. **Ensure your database is running** and `.env` in the project root has `DB_HOST`, `DB_PORT`, `DB_NAME`, `DB_USER`, and `DB_PASS` (same as for `dump-icons.sh` / `restore-icons.sh`).
2. **Optional:** Set which icon group to attach icons to:
- `ICON_GROUP_ID` (default: `01KD7DG4VCTWZRSA54M3PEJ6NW` — پک آیکون 1). Use an existing `icon_groups.id` from your DB.
3. **From the project root**, run:
```bash
node dump/import-named-icons.js
```
The script reads `dump/named_icons.csv` (columns: Index, Name, URL) and inserts one row per URL into `icons` with generated ULID and timestamps. The **Name** column is not stored (the `icons` table has no name column); only **URL** and **group_id** are used.