feat: remove old files and update workflows for gitea #1

Merged
rmcampos merged 1 commits from feat/updates-for-gitea into main 2026-07-04 21:49:49 +00:00
6 changed files with 1906 additions and 1498 deletions
Showing only changes of commit 1eba605146 - Show all commits
+31 -26
View File
@@ -1,6 +1,7 @@
name: Deploy to GitHub Pages name: Build & Deploy to Pages
on: on:
workflow_dispatch:
push: push:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
@@ -11,9 +12,12 @@ concurrency:
group: "pages" group: "pages"
cancel-in-progress: false cancel-in-progress: false
env:
APP_FOLDER: "calories-tracker"
jobs: jobs:
build: build-deploy:
runs-on: ubuntu-latest runs-on: easynode-debian
env: env:
VITE_APPWRITE_PROJECT_ID: ${{ secrets.VITE_APPWRITE_PROJECT_ID }} VITE_APPWRITE_PROJECT_ID: ${{ secrets.VITE_APPWRITE_PROJECT_ID }}
VITE_APPWRITE_ENDPOINT: ${{ secrets.VITE_APPWRITE_ENDPOINT }} VITE_APPWRITE_ENDPOINT: ${{ secrets.VITE_APPWRITE_ENDPOINT }}
@@ -28,11 +32,13 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node.js - name: Cache npm dependencies
uses: actions/setup-node@v4 uses: actions/cache@v3
with: with:
node-version: '22' path: ~/.npm
cache: 'npm' key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@@ -40,25 +46,24 @@ jobs:
- name: Build - name: Build
run: npm run build run: npm run build
- name: Upload artifact - name: Install rsync + ssh client
uses: actions/upload-pages-artifact@v3 run: apt-get update -qq && apt-get install -y -qq rsync openssh-client
with:
path: ./dist
deploy: - name: Configure SSH
environment: run: |
name: github-pages mkdir -p ~/.ssh
url: ${{ steps.deployment.outputs.page_url }} echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
runs-on: ubuntu-latest chmod 600 ~/.ssh/deploy_key
needs: build ssh-keyscan -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts
steps: - name: Ensure destination folder exists
- name: Deploy to GitHub Pages run: |
id: deployment ssh -i ~/.ssh/deploy_key deploy@${{ secrets.DEPLOY_HOST }} \
uses: actions/deploy-pages@v4 "mkdir -p /srv/sites/${{ env.APP_FOLDER }} && chmod 755 /srv/sites/${{ env.APP_FOLDER }}"
- name: Upload site
run: |
rsync -avz --delete \
-e "ssh -i ~/.ssh/deploy_key" \
./dist/ deploy@${{ secrets.DEPLOY_HOST }}:/srv/sites/${{ env.APP_FOLDER }}/
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
-75
View File
@@ -1,75 +0,0 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Development Commands
- `npm run dev` - Start development server (Vite)
- `npm run build` - Build for production
- `npm run preview` - Preview production build
## Environment Setup
Requires environment variables in `.env`:
- `VITE_APPWRITE_ENDPOINT` - Appwrite server endpoint
- `VITE_APPWRITE_DBID` - Database ID
- `VITE_APPWRITE_FOODENTRIESID` - Food entries collection ID
- `VITE_APPWRITE_USERSETTINGSID` - User settings collection ID
- `VITE_APPWRITE_MONTLYCALORIESID` - Monthly calories collection ID
## Architecture Overview
This is a TypeScript/Vite-based calories tracking application with Appwrite backend integration. Key architectural patterns:
### Core Structure
- **Entry Point**: `src/index.ts` - Main application logic and DOM manipulation
- **State Management**: `src/state.ts` - Centralized application state
- **Backend Integration**: `src/appwrite.ts` - Appwrite client and database operations
- **Type Definitions**: `src/types.ts` - TypeScript interfaces for data models
### Data Flow
- User authentication managed through `AppwriteAuth` class
- Food entries stored via `AppwriteDB` class with real-time Appwrite sync
- Local food database in `src/foodDatabase.ts` for searching
- Calendar view tracks daily calorie totals separately from individual entries
### Key Components
- **Authentication**: Login/register forms with session management
- **Food Search**: Real-time search with keyboard navigation and debouncing
- **Food Entry**: Add/edit/delete food items with nutritional calculations
- **Calendar**: Monthly calendar view with daily calorie totals
- **Settings**: User-configurable nutritional goals
### State Management Patterns
- Global app state in `appState` object
- Date-based data loading (selectedDate/currentViewDate)
- Monthly calorie aggregation separate from individual food entries
- Real-time UI updates after database operations
### DOM Manipulation
- Utility functions in `src/DomUtils.ts` for type-safe DOM access
- Event listeners centralized in `setupEventListeners()`
- Dynamic card creation for food entries with collapsible details
### Backend Integration
- All data operations use Appwrite SDK
- User-scoped queries with proper authentication
- Concurrent operations for bulk deletions
- Timezone-aware date handling for cross-timezone consistency
## Code Patterns
### Data Calculations
- All nutrition values calculated from 100g base values in food database
- Proportional scaling based on user-entered grams
- Real-time preview updates during food entry
### Error Handling
- Try-catch blocks with user-friendly SweetAlert notifications
- Loading states during async operations
- Graceful fallbacks for missing data
### Event Management
- Event listener cleanup and re-attachment for dynamic content
- Keyboard navigation support (arrows, enter, escape)
- Click-outside handlers for dropdowns and modals
+6 -2
View File
@@ -1,8 +1,12 @@
![Calories Tracker](https://img.shields.io/badge/status-active-brightgreen) ![Version](https://img.shields.io/badge/version-1.0.0-blue) ![License](https://img.shields.io/badge/license-ISC-orange)
# 🍽️ Calories Tracker # 🍽️ Calories Tracker
A modern, responsive web application for tracking daily food intake, calories, and nutritional information. Built with TypeScript, Vite, and Appwrite for a seamless food logging experience. A modern, responsive web application for tracking daily food intake, calories, and nutritional information. Built with TypeScript, Vite, and Appwrite for a seamless food logging experience.
![Calories Tracker](https://img.shields.io/badge/status-active-brightgreen) ![Version](https://img.shields.io/badge/version-1.0.0-blue) ![License](https://img.shields.io/badge/license-ISC-orange) ## Live
https://calories-tracker.lightroasted.vps-kinghost.net
## ✨ Features ## ✨ Features
@@ -72,7 +76,7 @@ VITE_APPWRITE_USERSETTINGSID=your_user_settings_collection_id
1. **Clone the repository** 1. **Clone the repository**
```bash ```bash
git clone https://github.com/yourusername/calories-tracker.git git clone https://lightroasted.vps-kinghost.net/rmcampos/calories-tracker.git
cd calories-tracker cd calories-tracker
``` ```
+1861 -1378
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -13,13 +13,13 @@
"description": "", "description": "",
"devDependencies": { "devDependencies": {
"typescript": "^6.0.3", "typescript": "^6.0.3",
"vite": "^7.3.2", "vite": "^8.1.3",
"vite-plugin-pwa": "^1.2.0", "vite-plugin-pwa": "^1.3.0",
"workbox-window": "^7.4.0" "workbox-window": "^7.4.1"
}, },
"dependencies": { "dependencies": {
"@anthropic-ai/sdk": "^0.91.1", "@anthropic-ai/sdk": "^0.110.0",
"appwrite": "^24.2.0", "appwrite": "^26.1.0",
"sweetalert": "^2.1.2" "sweetalert": "^2.1.2"
} }
} }
-9
View File
@@ -1,9 +0,0 @@
# TODO
- [x] Allow search without special characters
- [x] Get the calories from the last 7 days and display in the calendar
- [x] Add food type: Alkaline or Acid
- [x] Display the percentage of Alkaline daily
- [x] Remove the table and create a list-like component
- [x] Add logo
- [ ] Group food added by time and consider a meal