Skip to content

Commit 9840e2a

Browse files
committed
refactor: improve accessibility and code structure in UI components
1 parent 8a67d09 commit 9840e2a

File tree

11 files changed

+169
-130
lines changed

11 files changed

+169
-130
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
node-version: '20'
3232
cache: 'npm'
3333
- run: npm ci
34-
- run: npm audit --audit-level moderate
34+
- run: npm audit --audit-level high
3535

3636
deploy:
3737
needs: [test, security]

API.md

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,39 @@
55
Petalytics integrates directly with OpenRouter API for AI-powered pet insights.
66

77
### Authentication
8+
89
Users provide their own OpenRouter API key through the Guardian Panel.
910

1011
### Analysis Request Format
12+
1113
```typescript
1214
interface AnalysisRequest {
13-
pet: {
14-
name: string;
15-
breed: string;
16-
age: number;
17-
gender: 'male' | 'female';
18-
};
19-
entry: {
20-
content: string;
21-
date: string;
22-
mood?: string;
23-
activityLevel?: string;
24-
};
25-
recentHistory: JournalEntry[];
15+
pet: {
16+
name: string;
17+
breed: string;
18+
age: number;
19+
gender: 'male' | 'female';
20+
};
21+
entry: {
22+
content: string;
23+
date: string;
24+
mood?: string;
25+
activityLevel?: string;
26+
};
27+
recentHistory: JournalEntry[];
2628
}
2729
```
2830

2931
### Analysis Response Format
3032

3133
```typescript
3234
interface AnalysisResult {
33-
summary: string;
34-
moodTrend: 'improving' | 'stable' | 'concerning';
35-
activityLevel: 'low' | 'normal' | 'high';
36-
healthConcerns: string[];
37-
recommendations: string[];
38-
nextCheckupSuggestion?: string;
35+
summary: string;
36+
moodTrend: 'improving' | 'stable' | 'concerning';
37+
activityLevel: 'low' | 'normal' | 'high';
38+
healthConcerns: string[];
39+
recommendations: string[];
40+
nextCheckupSuggestion?: string;
3941
}
4042
```
4143

@@ -63,10 +65,10 @@ Each line contains a JSON object:
6365

6466
### Import Validation
6567

66-
* File must have `.jsonl` extension
67-
* Version compatibility checking
68-
* Data structure validation
69-
* Duplicate handling
68+
- File must have `.jsonl` extension
69+
- Version compatibility checking
70+
- Data structure validation
71+
- Duplicate handling
7072

7173
## LocalStorage Schema
7274

@@ -88,10 +90,13 @@ localStorage.setItem('petalytics-pets', JSON.stringify([
8890
### Guardian Data
8991

9092
```javascript
91-
localStorage.setItem('petalytics-guardian', JSON.stringify({
92-
name: string,
93-
apiKey: string,
94-
preferences: object,
95-
apiKeyValid: boolean
96-
}));
97-
```
93+
localStorage.setItem(
94+
'petalytics-guardian',
95+
JSON.stringify({
96+
name: string,
97+
apiKey: string,
98+
preferences: object,
99+
apiKeyValid: boolean,
100+
})
101+
);
102+
```

CONTRIBUTING.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ Thank you for your interest in contributing to Petalytics! This guide will help
55
## Development Setup
66

77
1. **Fork and clone the repository**
8+
89
```bash
910
git clone https://github.com/YOUR_USERNAME/petalytics.git
1011
cd petalytics
1112
```
1213

1314
2. **Install dependencies**
15+
1416
```bash
1517
npm install
1618
```
@@ -22,10 +24,10 @@ Thank you for your interest in contributing to Petalytics! This guide will help
2224

2325
## Code Style
2426

25-
* **TypeScript** - Use TypeScript for all new code
26-
* **ESLint** - Follow the configured linting rules
27-
* **Prettier** - Code formatting is automated
28-
* **Conventional Commits** - Use conventional commit messages
27+
- **TypeScript** - Use TypeScript for all new code
28+
- **ESLint** - Follow the configured linting rules
29+
- **Prettier** - Code formatting is automated
30+
- **Conventional Commits** - Use conventional commit messages
2931

3032
### Example commit messages:
3133

@@ -37,9 +39,9 @@ docs: update README with new features
3739

3840
## Testing
3941

40-
* Write tests for new features
41-
* Run tests before submitting PRs: `npm test`
42-
* Ensure type checking passes: `npm run check`
42+
- Write tests for new features
43+
- Run tests before submitting PRs: `npm test`
44+
- Ensure type checking passes: `npm run check`
4345

4446
## Pull Request Process
4547

@@ -51,13 +53,13 @@ docs: update README with new features
5153

5254
## Areas for Contribution
5355

54-
* **AI Prompts** - Improve breed-specific analysis
55-
* **Themes** - Add new color schemes
56-
* **Mobile UX** - Enhance mobile experience
57-
* **Accessibility** - Improve screen reader support
58-
* **Testing** - Add more comprehensive tests
59-
* **Documentation** - Improve guides and examples
56+
- **AI Prompts** - Improve breed-specific analysis
57+
- **Themes** - Add new color schemes
58+
- **Mobile UX** - Enhance mobile experience
59+
- **Accessibility** - Improve screen reader support
60+
- **Testing** - Add more comprehensive tests
61+
- **Documentation** - Improve guides and examples
6062

6163
## Questions?
6264

63-
Open an issue or reach out to the maintainers!
65+
Open an issue or reach out to the maintainers!

README.md

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
## ✨ Features
99

1010
- **🤖 AI-Powered Insights** - Get personalized care recommendations using OpenRouter API
11-
- **📝 Smart Journaling** - Record daily activities, mood, and behavior patterns
11+
- **📝 Smart Journaling** - Record daily activities, mood, and behavior patterns
1212
- **🎨 Beautiful Themes** - 4 gorgeous themes (Everforest, Gruvbox Dark, Tokyo Night, Nord)
1313
- **📊 Health Tracking** - Monitor wellness trends over time
1414
- **🔒 Privacy First** - Your data stays local, export/import JSONL files
@@ -17,17 +17,20 @@
1717
## 🚀 Quick Start
1818

1919
### 1. Get an OpenRouter API Key
20+
2021
- Visit [OpenRouter.ai](https://openrouter.ai)
2122
- Sign up and get your API key
2223
- Copy the key (starts with `sk-or-`)
2324

2425
### 2. Use the App
26+
2527
- Visit [Petalytics](https://petalytics.vercel.app)
2628
- Enter your API key in Guardian Settings
2729
- Create your first pet profile
2830
- Start journaling!
2931

3032
### 3. Local Development
33+
3134
```bash
3235
git clone https://github.com/gitcoder89431/petalytics.git
3336
cd petalytics
@@ -41,86 +44,86 @@ npm run dev
4144

4245
### Key Innovations
4346

44-
* **BYOK Model** - No backend costs, users own their data
45-
* **Shell App Architecture** - Fully client-side with export/import
46-
* **Breed-Specific AI** - Tailored insights based on pet characteristics
47-
* **Beautiful 3-Panel Layout** - Inspired by modern desktop environments
47+
- **BYOK Model** - No backend costs, users own their data
48+
- **Shell App Architecture** - Fully client-side with export/import
49+
- **Breed-Specific AI** - Tailored insights based on pet characteristics
50+
- **Beautiful 3-Panel Layout** - Inspired by modern desktop environments
4851

4952
### Tech Highlights
5053

51-
* SvelteKit + TypeScript for performance
52-
* Direct browser → OpenRouter API integration
53-
* Theme system extracted from omarchy-theme-builder
54-
* JSONL data portability
55-
* Zero database dependencies
54+
- SvelteKit + TypeScript for performance
55+
- Direct browser → OpenRouter API integration
56+
- Theme system extracted from omarchy-theme-builder
57+
- JSONL data portability
58+
- Zero database dependencies
5659

5760
## 📊 Usage
5861

5962
### 1. Guardian Setup (Top-Left Panel)
6063

61-
* Configure your profile and API key
62-
* Choose from 4 beautiful themes
63-
* Set preferences and reminders
64+
- Configure your profile and API key
65+
- Choose from 4 beautiful themes
66+
- Set preferences and reminders
6467

6568
### 2. Pet Management (Bottom-Left Panel)
6669

67-
* Create pet profiles with photos
68-
* Add breed, age, and basic info
69-
* Select active pet for journaling
70+
- Create pet profiles with photos
71+
- Add breed, age, and basic info
72+
- Select active pet for journaling
7073

7174
### 3. Main Dashboard (Right Panel)
7275

73-
* View pet stats and recent activity
74-
* Write new journal entries
75-
* See AI analysis and recommendations
76-
* Browse journal history
76+
- View pet stats and recent activity
77+
- Write new journal entries
78+
- See AI analysis and recommendations
79+
- Browse journal history
7780

7881
## 🤖 AI Features
7982

8083
The AI analyzes journal entries considering:
8184

82-
* **Breed-specific traits** (Golden Retriever vs Persian Cat)
83-
* **Age-appropriate behavior** (puppy vs senior dog)
84-
* **Historical patterns** (mood trends over time)
85-
* **Health indicators** (activity level changes)
85+
- **Breed-specific traits** (Golden Retriever vs Persian Cat)
86+
- **Age-appropriate behavior** (puppy vs senior dog)
87+
- **Historical patterns** (mood trends over time)
88+
- **Health indicators** (activity level changes)
8689

8790
Sample AI insights:
8891

89-
* "Max seems more lethargic than usual for a young Golden Retriever"
90-
* "Consider increasing mental stimulation based on recent boredom signs"
91-
* "Schedule vet checkup - senior cats should be monitored closely"
92+
- "Max seems more lethargic than usual for a young Golden Retriever"
93+
- "Consider increasing mental stimulation based on recent boredom signs"
94+
- "Schedule vet checkup - senior cats should be monitored closely"
9295

9396
## 🔐 Privacy & Data
9497

95-
* **Local First** - All data stored in browser localStorage
96-
* **No Backend** - Direct API calls to OpenRouter
97-
* **Export/Import** - Download JSONL backups anytime
98-
* **BYOK** - Bring your own API key, control your costs
98+
- **Local First** - All data stored in browser localStorage
99+
- **No Backend** - Direct API calls to OpenRouter
100+
- **Export/Import** - Download JSONL backups anytime
101+
- **BYOK** - Bring your own API key, control your costs
99102

100103
## 🎨 Themes
101104

102105
Four beautiful themes extracted from omarchy-theme-builder:
103106

104-
* **Everforest** - Comfortable green forest theme
105-
* **Gruvbox Dark** - Warm, retro-inspired colors
106-
* **Tokyo Night** - Modern dark with purple accents
107-
* **Nord** - Cool arctic-inspired palette
107+
- **Everforest** - Comfortable green forest theme
108+
- **Gruvbox Dark** - Warm, retro-inspired colors
109+
- **Tokyo Night** - Modern dark with purple accents
110+
- **Nord** - Cool arctic-inspired palette
108111

109112
## 📱 Responsive Design
110113

111-
* **Desktop** - Full 3-panel layout with optimal workflow
112-
* **Tablet** - Adaptive layout with collapsible panels
113-
* **Mobile** - Stacked panels for touch-friendly navigation
114+
- **Desktop** - Full 3-panel layout with optimal workflow
115+
- **Tablet** - Adaptive layout with collapsible panels
116+
- **Mobile** - Stacked panels for touch-friendly navigation
114117

115118
## 🛠️ Development
116119

117120
### Tech Stack
118121

119-
* **Frontend**: SvelteKit + TypeScript
120-
* **Styling**: Tailwind CSS + Custom themes
121-
* **AI**: OpenRouter API (Claude, GPT models)
122-
* **Deployment**: Vercel
123-
* **Data**: localStorage + JSONL export/import
122+
- **Frontend**: SvelteKit + TypeScript
123+
- **Styling**: Tailwind CSS + Custom themes
124+
- **AI**: OpenRouter API (Claude, GPT models)
125+
- **Deployment**: Vercel
126+
- **Data**: localStorage + JSONL export/import
124127

125128
### Scripts
126129

@@ -160,10 +163,10 @@ MIT License - see [LICENSE](LICENSE) for details.
160163

161164
## 🙏 Acknowledgments
162165

163-
* OpenRouter for providing accessible AI APIs
164-
* Omarchy theme system for beautiful color palettes
165-
* SvelteKit team for an amazing framework
166-
* Contest organizers for the opportunity
166+
- OpenRouter for providing accessible AI APIs
167+
- Omarchy theme system for beautiful color palettes
168+
- SvelteKit team for an amazing framework
169+
- Contest organizers for the opportunity
167170

168171
---
169172

src/lib/components/panels/GuardianPanel.svelte

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import ThemeSelector from '../ui/ThemeSelector.svelte';
44
import DataManager from '../ui/DataManager.svelte';
55
import { User, Key, Settings, CheckCircle, AlertCircle } from 'lucide-svelte';
6-
import { guardianStore, guardianHelpers } from '$lib/stores/guardian.js';
6+
import { guardianHelpers } from '$lib/stores/guardian.js';
77
import { aiAnalysisHelpers } from '$lib/stores/ai-analysis.js';
88
99
let apiKeyInput = '';
@@ -88,10 +88,15 @@
8888
<div class="panel-content flex-1 p-4 space-y-4 overflow-y-auto">
8989
<!-- Guardian Info -->
9090
<div class="section">
91-
<label class="block text-sm font-medium mb-2" style="color: var(--petalytics-subtle);">
91+
<label
92+
for="guardian-name"
93+
class="block text-sm font-medium mb-2"
94+
style="color: var(--petalytics-subtle);"
95+
>
9296
Your Name
9397
</label>
9498
<input
99+
id="guardian-name"
95100
type="text"
96101
bind:value={guardianName}
97102
on:blur={saveGuardianInfo}
@@ -139,10 +144,14 @@
139144

140145
<!-- Theme Selection -->
141146
<div class="section">
142-
<label class="block text-sm font-medium mb-2" style="color: var(--petalytics-subtle);">
147+
<label
148+
for="theme-selector"
149+
class="block text-sm font-medium mb-2"
150+
style="color: var(--petalytics-subtle);"
151+
>
143152
Theme
144153
</label>
145-
<ThemeSelector />
154+
<ThemeSelector id="theme-selector" />
146155
</div>
147156

148157
<!-- Settings -->

0 commit comments

Comments
 (0)