feat: remove old files and update workflows for gitea

This commit is contained in:
2026-07-04 23:45:30 +02:00
parent 0746088203
commit 1eba605146
6 changed files with 1906 additions and 1498 deletions
+34 -29
View File
@@ -1,6 +1,7 @@
name: Deploy to GitHub Pages
name: Build & Deploy to Pages
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
@@ -11,9 +12,12 @@ concurrency:
group: "pages"
cancel-in-progress: false
env:
APP_FOLDER: "calories-tracker"
jobs:
build:
runs-on: ubuntu-latest
build-deploy:
runs-on: easynode-debian
env:
VITE_APPWRITE_PROJECT_ID: ${{ secrets.VITE_APPWRITE_PROJECT_ID }}
VITE_APPWRITE_ENDPOINT: ${{ secrets.VITE_APPWRITE_ENDPOINT }}
@@ -27,38 +31,39 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Cache npm dependencies
uses: actions/cache@v3
with:
node-version: '22'
cache: 'npm'
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Install rsync + ssh client
run: apt-get update -qq && apt-get install -y -qq rsync openssh-client
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts
- name: Ensure destination folder exists
run: |
ssh -i ~/.ssh/deploy_key deploy@${{ secrets.DEPLOY_HOST }} \
"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
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
@@ -72,7 +76,7 @@ VITE_APPWRITE_USERSETTINGSID=your_user_settings_collection_id
1. **Clone the repository**
```bash
git clone https://github.com/yourusername/calories-tracker.git
git clone https://lightroasted.vps-kinghost.net/rmcampos/calories-tracker.git
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": "",
"devDependencies": {
"typescript": "^6.0.3",
"vite": "^7.3.2",
"vite-plugin-pwa": "^1.2.0",
"workbox-window": "^7.4.0"
"vite": "^8.1.3",
"vite-plugin-pwa": "^1.3.0",
"workbox-window": "^7.4.1"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.91.1",
"appwrite": "^24.2.0",
"@anthropic-ai/sdk": "^0.110.0",
"appwrite": "^26.1.0",
"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