Skip to content

Commit cdd6c7e

Browse files
Merge pull request #54 from foundersandcoders/feat/actions-crud-management-issue-53
feat: implement comprehensive actions CRUD management
2 parents 80d7821 + 2cf1fcc commit cdd6c7e

File tree

9 files changed

+645
-83
lines changed

9 files changed

+645
-83
lines changed

src/app.css

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,135 @@ h3 {
258258
align-items: center;
259259
}
260260

261+
.breadcrumb {
262+
font-size: 1.25rem;
263+
font-weight: 700;
264+
}
265+
266+
.breadcrumb-list {
267+
@apply m-0 flex list-none items-center p-0;
268+
white-space: nowrap;
269+
overflow: hidden;
270+
min-width: 0;
271+
flex: 1;
272+
}
273+
274+
.breadcrumb-item {
275+
@apply flex items-center flex-shrink-0;
276+
}
277+
278+
.breadcrumb-item:last-child {
279+
@apply flex-shrink min-w-0;
280+
max-width: 100%;
281+
}
282+
283+
.breadcrumb-link {
284+
@apply text-accent-content cursor-pointer border-none bg-transparent p-0 font-normal underline transition-colors hover:text-white;
285+
}
286+
287+
.breadcrumb-current {
288+
@apply text-accent-content font-bold;
289+
overflow: hidden;
290+
text-overflow: ellipsis;
291+
white-space: nowrap;
292+
}
293+
294+
.breadcrumb-separator {
295+
@apply text-accent-content/70 font-normal flex-shrink-0;
296+
margin: 0 0.25rem;
297+
}
298+
299+
.actions-crud {
300+
@apply space-y-4;
301+
}
302+
303+
.actions-header {
304+
@apply mb-4;
305+
}
306+
307+
.actions-list {
308+
@apply space-y-3;
309+
}
310+
311+
.action-item {
312+
@apply card border-primary bg-base-100 mb-3 rounded-lg border-2 p-3 transition-shadow hover:shadow-md;
313+
}
314+
315+
.action-view {
316+
@apply flex items-start justify-between gap-3;
317+
}
318+
319+
.action-content {
320+
@apply flex-1;
321+
}
322+
323+
.action-description {
324+
@apply text-base-content mb-2 font-medium;
325+
}
326+
327+
.action-date {
328+
@apply text-base-content/60 text-xs;
329+
}
330+
331+
.action-buttons {
332+
@apply flex flex-shrink-0 gap-2;
333+
}
334+
335+
.action-edit-form {
336+
@apply space-y-3;
337+
}
338+
339+
.action-description-input {
340+
@apply textarea border-primary focus:border-accent w-full rounded-lg border p-3 outline-none;
341+
}
342+
343+
.action-edit-buttons {
344+
@apply flex gap-2;
345+
}
346+
347+
.action-edit-buttons .btn-sm {
348+
@apply btn btn-sm;
349+
}
350+
351+
.action-edit-buttons .btn-submit {
352+
@apply btn btn-accent hover:btn-secondary text-base-100 btn-sm;
353+
}
354+
355+
.new-action-form {
356+
@apply card border-primary bg-base-100 space-y-3 rounded-lg border-2 border-dashed p-4;
357+
}
358+
359+
.new-action-buttons {
360+
@apply flex gap-2;
361+
}
362+
363+
.new-action-buttons .btn-sm {
364+
@apply btn btn-sm;
365+
}
366+
367+
.new-action-buttons .btn-submit {
368+
@apply btn btn-accent hover:btn-secondary text-base-100 btn-sm;
369+
}
370+
371+
.add-action-btn {
372+
@apply border-primary hover:border-accent w-full;
373+
}
374+
375+
/* Error states */
376+
.border-error {
377+
@apply border-error;
378+
}
379+
380+
/* Loading states */
381+
.btn:disabled {
382+
@apply opacity-50 cursor-not-allowed;
383+
}
384+
385+
.loading-xs {
386+
width: 1rem;
387+
height: 1rem;
388+
}
389+
261390
@media (max-width: 375px) {
262391
.dash-grid {
263392
@apply grid-cols-1;

src/lib/components/cards/QuestionCard.svelte

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { getContext } from 'svelte';
88
import type { AppState } from '$lib/types/appState';
99
import ConfirmModal from '../ui/ConfirmModal.svelte';
10+
import ActionsCRUD from '../ui/ActionsCRUD.svelte';
1011
1112
// App State
1213
const getApp = getContext<() => AppState>('getApp');
@@ -52,8 +53,6 @@
5253
let table: TableName = $state('responses');
5354
let connectionDetails = $state<QuestionConnections>({
5455
responseInput: null,
55-
actionsInput: null,
56-
actionType: null,
5756
responseId: null,
5857
visibility: 'private'
5958
});
@@ -71,11 +70,6 @@
7170
connectionDetails.responseInput.trim() !== ''
7271
);
7372
74-
const hasActionContent = $derived(
75-
connectionDetails.actionsInput !== null &&
76-
connectionDetails.actionsInput !== undefined &&
77-
connectionDetails.actionsInput.trim() !== ''
78-
);
7973
8074
const buttonConfig = $derived(() => {
8175
return isUpdate
@@ -87,9 +81,6 @@
8781
$inspect(hasResponseContent).with((type, value) =>
8882
console.log(`📝 hasResponseContent: ${type} ${value}`)
8983
);
90-
$inspect(hasActionContent).with((type, value) =>
91-
console.log(`📝 hasActionContent: ${type} ${value}`)
92-
);
9384
$inspect(buttonConfig().primaryText).with((type, value) =>
9485
console.log(`🔘 Button 1: ${type} ${value}`)
9586
);
@@ -118,7 +109,6 @@
118109
119110
// Update visibility based on details or default to 'private'
120111
visibility = connections.visibility || 'private';
121-
connectionDetails.actionsInput = null;
122112
123113
const data = {
124114
queryId: questionId,
@@ -178,19 +168,7 @@
178168
</div>
179169

180170
<div id="question-{questionId}-actions" class="card-content">
181-
<div id="question-{questionId}-action-response" class="flex flex-col">
182-
<label for="question-{questionId}-action-response-text" class="form-label">
183-
Would you like your manager to take any actions in response to this?
184-
</label>
185-
186-
<textarea
187-
id="question-{questionId}-actions-response-text"
188-
bind:value={connectionDetails.actionsInput}
189-
placeholder="Enter your response here..."
190-
rows="3"
191-
class="text-area form-textarea"
192-
></textarea>
193-
</div>
171+
<ActionsCRUD responseId={connectionDetails.responseId} />
194172
</div>
195173

196174
<div id="question-{questionId}-buttons" class="flex justify-around">
@@ -200,7 +178,6 @@
200178
{table}
201179
{isUpdate}
202180
{hasResponseContent}
203-
{hasActionContent}
204181
details={connectionDetails}
205182
{visibility}
206183
/>
@@ -210,7 +187,6 @@
210187
{table}
211188
{isUpdate}
212189
{hasResponseContent}
213-
{hasActionContent}
214190
details={connectionDetails}
215191
{visibility}
216192
onclick={isUpdate ? openDeleteModal : undefined}

src/lib/components/layouts/ViewHeader.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import HelpButton from '../ui/HelpButton.svelte';
3+
import Breadcrumb from '../ui/Breadcrumb.svelte';
34
45
interface Props {
56
title: string;
@@ -10,7 +11,7 @@
1011
</script>
1112

1213
<div id="{title}-header" class="view-header">
13-
<h2 class="text-accent-content">{title}</h2>
14+
<Breadcrumb />
1415

1516
<div class="flex items-center gap-3">
1617
{#if onclick}

0 commit comments

Comments
 (0)