Commit e8fd249
committed
aider: Add created date to PromptResult, create computed property sortedPromptResults, and add space between rows.
# Context:
USER: add a created date to the PromptResult as a timestamp, create a computed property: sortedPromptResults, add some space between the rows
ASSISTANT: To add a created date to the `PromptResult` as a timestamp, create a computed property `sortedPromptResults`, and add some space between the rows, you will need to modify the `App.vue` file. Here are the steps:
1. Update the `PromptResult` interface to include a `created` property.
2. Modify the `sendPrompt` method to add the current timestamp when a new prompt result is created.
3. Create a computed property `sortedPromptResults` that sorts the results by the created date.
4. Update the CSS to add space between the rows.
Here are the changes you need to make:
```vue
fe-clients/vue-ts/src/App.vue
<<<<<<< ORIGINAL
interface PromptResult {
prompt: string;
results: Record<string, any>[];
sql: string;
}
=======
import { computed } from "vue";
interface PromptResult {
prompt: string;
results: Record<string, any>[];
sql: string;
created: number; // Timestamp for the created date
}
// Computed property to sort prompt results by created date
const sortedPromptResults = computed(() => {
return [...promptResults.value].sort((a, b) => b.created - a.created);
});
>>>>>>> UPDATED
```
```vue
fe-clients/vue-ts/src/App.vue
<<<<<<< ORIGINAL
const data = await response.json();
data.results = JSON.parse(data.results); // Assuming 'results' is a JSON string that needs to be parsed
promptResults.value.push(data);
=======
const data: PromptResult = await response.json();
data.results = JSON.parse(data.results); // Assuming 'results' is a JSON string that needs to be parsed
data.created = Date.now(); // Add the current timestamp
promptResults.value.push(data);
>>>>>>> UPDATED
```
```vue
fe-clients/vue-ts/src/App.vue
<<<<<<< ORIGINAL
<section v-for="(result, index) in promptResults" :key="index">
=======
<section v-for="(result, index) in sortedPromptResults" :key="index">
>>>>>>> UPDATED
```
And for the CSS to add space between the rows:
```vue
fe-clients/vue-ts/src/App.vue
<<<<<<< ORIGINAL
section {
display: flex;
flex-direction: column;
gap: 1em;
padding: 1em;
}
=======
section {
display: flex;
flex-direction: column;
gap: 1.5em; /* Increased gap for more space between rows */
padding: 1em;
}
>>>>>>> UPDATED
```
These changes will add a timestamp to each `PromptResult`, sort the results by the created date in descending order, and increase the space between the rows. If you have any further requests or need additional changes, please let me know!1 parent d07fdec commit e8fd249
1 file changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
| |||
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
57 | | - | |
| 65 | + | |
58 | 66 | | |
| 67 | + | |
59 | 68 | | |
60 | 69 | | |
61 | 70 | | |
| |||
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
97 | | - | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
0 commit comments