Skip to content

Commit 75d5217

Browse files
Merge pull request #6 from foundersandcoders:ui-fixes
UI fixes
2 parents d054441 + 6617d36 commit 75d5217

36 files changed

+1089
-756
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ allcode.txt
2525
*.sw?
2626

2727
.env.*
28-
.env.development
28+
.env.development
29+
.aider*

allcode.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
import os
33

44
# Directories to exclude (won't be recursed into) - comparison done case-insensitively.
5-
EXCLUDE_DIRS = {"node_modules", ".git", ".github", "dist", "public"}
5+
EXCLUDE_DIRS = {
6+
"node_modules",
7+
".git",
8+
".github",
9+
"dist",
10+
"public",
11+
".aider.tags.cache.v3",
12+
}
613

714
# Files to exclude (by exact name, case-insensitive)
815
EXCLUDE_FILES = {
@@ -24,6 +31,8 @@
2431
".env.development",
2532
"vite-env.d.ts",
2633
".DS_Store",
34+
".aider.chat.history.md",
35+
".aider.input.history",
2736
}
2837

2938

data/setQuestions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"allowedVerbs": ["Share"]
1919
},
2020
"object": {
21-
"question": "List the factors affecting your wellbeing.",
21+
"question": "what?",
2222
"preset": false,
2323
"presetAnswer": null
2424
},

src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
'use client';
22

33
import React from 'react';
4-
import { StatementsProvider } from './context/StatementsProvider';
4+
import { EntriesProvider } from './context/EntriesProvider';
55
import LoginPage from './components/LoginPage';
66
import Header from './components/Header';
77
import MainPage from './components/MainPage';
88
import { TooltipProvider } from '@radix-ui/react-tooltip';
9-
import { useStatements } from './hooks/useStatements';
9+
import { useEntries } from './hooks/useEntries';
1010
import { QuestionsProvider } from './context/QuestionsProvider';
1111

1212
// Outer Component: Responsible only for setting up the environment (the providers) for the rest of the app.
1313
const AppContent: React.FC = () => {
14-
const { data, setData } = useStatements();
14+
const { data, setData } = useEntries();
1515

1616
const handleLoginSubmit = (username: string, managerEmail: string) => {
1717
// Dispatch an action to update the username in context.
@@ -36,11 +36,11 @@ const AppContent: React.FC = () => {
3636
const App: React.FC = () => {
3737
return (
3838
<TooltipProvider>
39-
<StatementsProvider>
39+
<EntriesProvider>
4040
<QuestionsProvider>
4141
<AppContent />
4242
</QuestionsProvider>
43-
</StatementsProvider>
43+
</EntriesProvider>
4444
</TooltipProvider>
4545
);
4646
};

src/api/entriesApi.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { Entry } from '../../types/entries';
2+
3+
const API_URL = import.meta.env.VITE_API_URL;
4+
console.log('Backend API:', API_URL);
5+
6+
export async function postNewEntry(entry: Entry): Promise<void> {
7+
try {
8+
const response = await fetch(`${API_URL}/write`, {
9+
method: 'POST',
10+
headers: {
11+
'Content-Type': 'application/json',
12+
},
13+
body: JSON.stringify(entry),
14+
});
15+
if (!response.ok) {
16+
throw new Error(`HTTP error on POST! status: ${response.status}`);
17+
}
18+
const data = await response.json();
19+
console.log('Successfully posted entry:', data);
20+
// Optionally fetch updated data if needed...
21+
} catch (error) {
22+
console.error('Error posting new entry:', error);
23+
}
24+
}
25+
26+
export async function updateEntry(entry: Entry): Promise<void> {
27+
try {
28+
const response = await fetch(`${API_URL}/updateEntry`, {
29+
method: 'PUT', // or PATCH, depending on your backend implementation
30+
headers: {
31+
'Content-Type': 'application/json',
32+
},
33+
body: JSON.stringify(entry),
34+
});
35+
if (!response.ok) {
36+
throw new Error(`HTTP error on update! status: ${response.status}`);
37+
}
38+
const data = await response.json();
39+
console.log('Successfully updated entry:', data);
40+
} catch (error) {
41+
console.error('Error updating entry:', error);
42+
}
43+
}

src/api/statementsApi.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)