Skip to content

Commit 63a4117

Browse files
committed
fix: resintated the creation on .env.development by github actions using Deno secrets
1 parent f05ddd4 commit 63a4117

File tree

4 files changed

+54
-43
lines changed

4 files changed

+54
-43
lines changed

.github/workflows/deploy.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
deploy:
1010
name: Deploy
1111
runs-on: ubuntu-latest
12+
environment: 'production'
1213

1314
permissions:
1415
id-token: write # Needed for auth with Deno Deploy
@@ -29,16 +30,18 @@ jobs:
2930
node-version: lts/*
3031

3132
- name: Install step
32-
run: "npm install"
33+
run: 'npm install'
34+
35+
- name: Create .env.production
36+
run: |
37+
echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" > .env.production
3338
3439
- name: Build step
35-
run: "npm run build"
40+
run: 'npm run build'
3641

3742
- name: Upload to Deno Deploy
3843
uses: denoland/deployctl@v1
3944
with:
40-
project: "lift-frontend"
41-
entrypoint: "https://deno.land/[email protected]/http/file_server.ts"
42-
root: "dist"
43-
44-
45+
project: 'lift-frontend'
46+
entrypoint: 'https://deno.land/[email protected]/http/file_server.ts'
47+
root: 'dist'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The deployment workflow is defined in `.github/workflows/deploy.yml`. It include
9898

9999
## Configuration
100100

101-
Configuration settings are managed through environment variables. Ensure you have a `.env` file in the root directory with the necessary variables:
101+
Configuration settings are managed through environment variables. Ensure you have a `.env.development` file in the root directory with the necessary variables:
102102

103103
```ini
104104
VITE_API_URL=<your_backend_api_url>

src/features/statements/components/StatementItem.tsx

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,28 @@ const StatementItem: React.FC<StatementItemProps> = ({
112112
originalCategory: externalOriginalCategory, // Get original category from parent
113113
}) => {
114114
const [isActionsExpanded, setIsActionsExpanded] = React.useState(false);
115-
115+
116116
// Create a ref for the component root element
117117
const itemRef = React.useRef<HTMLDivElement>(null);
118-
118+
119119
// Create refs to track category changes for animations
120120
const prevCategoryRef = React.useRef<string | null>(null);
121121

122122
// Use simple primitive values to store original state
123123
// This way we avoid object reference issues
124-
const [originalCategory, setOriginalCategory] = React.useState<string | null>(null);
125-
const [originalSubject, setOriginalSubject] = React.useState<string | null>(null);
124+
const [originalCategory, setOriginalCategory] = React.useState<string | null>(
125+
null
126+
);
127+
const [originalSubject, setOriginalSubject] = React.useState<string | null>(
128+
null
129+
);
126130
const [originalVerb, setOriginalVerb] = React.useState<string | null>(null);
127-
const [originalObject, setOriginalObject] = React.useState<string | null>(null);
128-
const [originalPrivacy, setOriginalPrivacy] = React.useState<boolean | null>(null);
131+
const [originalObject, setOriginalObject] = React.useState<string | null>(
132+
null
133+
);
134+
const [originalPrivacy, setOriginalPrivacy] = React.useState<boolean | null>(
135+
null
136+
);
129137

130138
// Local "draft" state to track current modifications
131139
const [draft, setDraft] = React.useState<Entry>(statement);
@@ -141,7 +149,7 @@ const StatementItem: React.FC<StatementItemProps> = ({
141149
// Use the external original category from parent if available, otherwise use the current category
142150
const originalCategoryValue =
143151
externalOriginalCategory ||
144-
(statement.category ? String(statement.category) : "");
152+
(statement.category ? String(statement.category) : '');
145153

146154
// Set it in the local state for immediate use in comparison
147155
setOriginalCategory(originalCategoryValue);
@@ -173,35 +181,33 @@ const StatementItem: React.FC<StatementItemProps> = ({
173181
// Keep draft updated with latest changes from the statement
174182
setDraft(JSON.parse(JSON.stringify(statement)));
175183
}
176-
// eslint-disable-next-line react-hooks/exhaustive-deps
177184
}, [statement, isEditing]);
178-
185+
179186
// Dedicated effect for scrolling when needed
180187
useEffect(() => {
181188
// Check if this statement was updated with a category change (flagged by EditStatementModal)
182189
if (isEditing && statement._needsScroll) {
183190
console.log('Statement flagged for scrolling:', statement.id);
184-
191+
185192
// Use a longer delay to ensure the DOM has fully updated
186193
const timer = setTimeout(() => {
187194
if (itemRef.current) {
188195
console.log('Executing scroll to element');
189196
// Force scroll to this element
190-
itemRef.current.scrollIntoView({
191-
behavior: 'smooth',
192-
block: 'center'
197+
itemRef.current.scrollIntoView({
198+
behavior: 'smooth',
199+
block: 'center',
193200
});
194201
console.log('Scroll instruction sent');
195202
}
196203
}, 500);
197-
204+
198205
return () => clearTimeout(timer);
199206
}
200-
207+
201208
// Keep reference updated for category change tracking
202209
prevCategoryRef.current = statement.category;
203-
// Check this effect whenever the statement reference changes
204-
// eslint-disable-next-line react-hooks/exhaustive-deps
210+
// Check this effect whenever the statement reference changes
205211
}, [statement, isEditing]);
206212

207213
// Helper function to normalize category values for comparison
@@ -232,8 +238,9 @@ const StatementItem: React.FC<StatementItemProps> = ({
232238
if (isEditing) {
233239
// Use the external original category if available, otherwise use local state
234240
// This ensures consistent comparison even after component remounts
235-
const effectiveOriginalCategory = externalOriginalCategory || originalCategory;
236-
241+
const effectiveOriginalCategory =
242+
externalOriginalCategory || originalCategory;
243+
237244
if (effectiveOriginalCategory !== null || originalCategory !== null) {
238245
// Compare current draft with original primitive values
239246
hasSubjectChanged = draft.atoms.subject !== originalSubject;
@@ -243,7 +250,9 @@ const StatementItem: React.FC<StatementItemProps> = ({
243250

244251
// Normalize categories for comparison
245252
const draftCategory = normalizeCategoryForComparison(draft.category);
246-
const originalCategoryNormalized = normalizeCategoryForComparison(effectiveOriginalCategory);
253+
const originalCategoryNormalized = normalizeCategoryForComparison(
254+
effectiveOriginalCategory
255+
);
247256

248257
// Compare normalized categories
249258
hasCategoryChanged = draftCategory !== originalCategoryNormalized;
@@ -260,10 +269,11 @@ const StatementItem: React.FC<StatementItemProps> = ({
260269

261270
if (isEditing) {
262271
return (
263-
<div
264-
ref={itemRef}
272+
<div
273+
ref={itemRef}
265274
id={`statement-${statement.id}`}
266-
className='bg-gray-100 p-3 rounded-lg shadow'>
275+
className='bg-gray-100 p-3 rounded-lg shadow'
276+
>
267277
{/* Desktop layout - horizontal row */}
268278
<div className='hidden md:flex md:items-center md:space-x-2'>
269279
{/* Privacy toggle button */}
@@ -789,4 +799,4 @@ const StatementItem: React.FC<StatementItemProps> = ({
789799
);
790800
};
791801

792-
export default StatementItem;
802+
export default StatementItem;

src/layouts/components/Header.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const Header: React.FC = () => {
99
const [isDashboardOpen, setIsDashboardOpen] = useState(false);
1010

1111
// Debug output to make sure username is correct
12-
console.log("Header rendering with username:", data.username);
13-
12+
//console.log("Header rendering with username:", data.username);
13+
1414
// Function to open the modal directly
1515
const openModal = () => {
16-
console.log("Opening modal directly");
16+
console.log('Opening modal directly');
1717
setIsDashboardOpen(true);
1818
};
1919

@@ -24,11 +24,7 @@ const Header: React.FC = () => {
2424
<div className='flex flex-wrap items-center justify-between'>
2525
{/* Left section: Logo */}
2626
<div className='flex items-center'>
27-
<img
28-
src='/lift_logo.png'
29-
alt='Logo'
30-
className='h-8 sm:h-10 mr-2'
31-
/>
27+
<img src='/lift_logo.png' alt='Logo' className='h-8 sm:h-10 mr-2' />
3228
</div>
3329

3430
{/* Center section: Title */}
@@ -40,7 +36,7 @@ const Header: React.FC = () => {
4036
<div className='flex items-center relative'>
4137
{data.username ? (
4238
<div>
43-
<button
39+
<button
4440
onClick={openModal}
4541
className='flex items-center border-2 border-white rounded-full px-2 py-1 sm:px-4 sm:py-2 cursor-pointer hover:bg-pink-600 transition-colors'
4642
>
@@ -56,9 +52,11 @@ const Header: React.FC = () => {
5652
<SmallCircularQuestionCounter size={18} />
5753
</div>
5854
)}
59-
55+
6056
{/* Render the modal directly when open */}
61-
{isDashboardOpen && <UserDataModal onOpenChange={setIsDashboardOpen} />}
57+
{isDashboardOpen && (
58+
<UserDataModal onOpenChange={setIsDashboardOpen} />
59+
)}
6260
</div>
6361
</div>
6462
</div>

0 commit comments

Comments
 (0)