Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparing Alpha Branch #3632

Merged
merged 13 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion apps/kbve.com/src/content/journal/12-25.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,20 @@ import { Adsense, Tasks } from '@kbve/astropad';
Okay! We are almost done with the generic or well base kanban board.
Getting it all operational is the goal for today, then I will shift over to adding additional features.
Okay we need to push forward with some of the minor updates and get the new docker image built out!
Let me move the rust and react code up for now and loop back around, hopefully resolving the CORS issue.
Let me move the rust and react code up for now and loop back around, hopefully resolving the CORS issue.
The docker image of 1.02 was published, so now I am going to update the helm chart and have it deploy the new one.

- 07:33AM

**React**

Okay we got the communication between the kanban and the react component going, now we just need to figure out how to maintain that easy flow.
Right now its not pulling the right data from the api state, so I am going to focus on resolving that next.

- 02:21PM

**MerryXMas**

Happy holidays!
Forgot to include that in my notes, xD
I am thinking of redoing the whole kanban system to help keep track of the notes a bit better, maybe even expanding the item collection that would be involved.
29 changes: 29 additions & 0 deletions apps/kbve.com/src/content/journal/12-26.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: 'Decemeber: 26th'
category: Daily
date: 2024-12-26 12:00:00
client: Self
unsplash: 1511512578047-dfb367046420
img: https://images.unsplash.com/photo-1511512578047-dfb367046420?crop=entropy&cs=srgb&fm=jpg&ixid=MnwzNjM5Nzd8MHwxfHJhbmRvbXx8fHx8fHx8fDE2ODE3NDg2ODY&ixlib=rb-4.0.3&q=85
description: Decemeber 26th.
tags:
- daily
---

import { Adsense, Tasks } from '@kbve/astropad';

## 2024

- 09:30AM

**SPY**

$600 for SPY!? This is great!

- 01:05PM

**Items**

The plan is to rework the kanban data structure, so that we can expand upon it.
Once the basic saving, loading and notes are done, we can move forward with adding in the AI tools around it.
If everything can get up and running, we can move back around to the AStar pathfinding in unity.
63 changes: 48 additions & 15 deletions apps/kbve.com/src/engine/kanban/KanbanBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class KanbanBase extends Kilobase {

/**
* Load board data by board_id from the API.
* Saves the fetched data to local storage.
* @param boardId - The board_id to load data for.
* @returns Promise<Record<string, { id: string; container: string }[]> | null> - The board data if found, or null if not found.
*/
Expand All @@ -102,7 +103,6 @@ export class KanbanBase extends Kilobase {
);

if (!response.ok) {
// If the response is not ok, log an error and return null
console.error(
`Failed to fetch board data for board ID: ${boardId}`,
);
Expand All @@ -111,17 +111,34 @@ export class KanbanBase extends Kilobase {

const result = await response.json();

// Validate the structure of the response
if (
result &&
typeof result === 'object' &&
'todo' in result &&
'in_progress' in result &&
'done' in result
'done' in result &&
'unassigned' in result &&
'metadata' in result &&
'actions' in result
) {
this.itemPositionsStore.set(result); // Cache the data locally
console.log(`Loaded board data for board ID: ${boardId}`);
return result;
// Save to local storage
const formattedResult = {
TODO: result.todo || [],
'IN-PROGRESS': result.in_progress || [],
DONE: result.done || [],
UNASSIGNED: result.unassigned || [],
};

this.itemPositionsStore.set(formattedResult);
console.log(
`Loaded and saved board data for board ID: ${boardId}`,
);

// Optionally, you could handle metadata and actions separately if needed
console.log('Metadata:', result.metadata);
console.log('Actions:', result.actions);

return formattedResult;
}

console.error(
Expand All @@ -130,7 +147,7 @@ export class KanbanBase extends Kilobase {
return null;
} catch (error) {
console.error('Error loading board data:', error);
return null; // Return null on error
return null;
}
}

Expand All @@ -144,18 +161,26 @@ export class KanbanBase extends Kilobase {
boardId: string,
data: Record<string, { id: string; container: string }[]>,
): Promise<void> {
// Save to local storage
this.itemPositionsStore.set(data);
console.log(`Saved board data to local storage for ${boardId}`);

// Save to the API
try {
const currentPositions = this.itemPositionsStore.get();

// Ensure data structure matches what the API expects

const formattedData = {
board_id: boardId,
todo: currentPositions.TODO || [],
in_progress: currentPositions['IN-PROGRESS'] || [],
done: currentPositions.DONE || [],
};
console.log('Saving to API with data:', formattedData);

// Save to the API
const response = await fetch(
`https://kanban.kbve.com/api/get_board`,
`https://kanban.kbve.com/api/save_board`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ board_id: boardId, ...data }),
body: JSON.stringify(formattedData),
},
);

Expand All @@ -166,6 +191,7 @@ export class KanbanBase extends Kilobase {
console.log(`Saved board data to API for ${boardId}`);
} catch (error) {
console.error('Error saving board data:', error);
throw error;
}
}

Expand All @@ -176,7 +202,14 @@ export class KanbanBase extends Kilobase {
*/
async validateBoardId(boardId: string): Promise<boolean> {
const boardData = await this.loadBoardData(boardId);
return boardData !== null; // Valid if board data is found

if (boardData) {
console.log('Validation passed for board ID:', boardId);
return true;
}

console.error('Validation failed for board ID:', boardId);
return false;
}
}

Expand Down
Loading
Loading