feat: showing recipe list values
- add displaying for values in recipe list, with some editable fields except topping, string params, feed pattern/level Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
4866674f26
commit
dbb5ce466c
14 changed files with 640 additions and 37 deletions
|
|
@ -6,7 +6,9 @@ import {
|
|||
recipeDataError,
|
||||
recipeLoading,
|
||||
recipeOverviewData,
|
||||
recipeStreamMeta
|
||||
recipeStreamMeta,
|
||||
toppingGroupFromServerQuery,
|
||||
toppingListFromServerQuery
|
||||
} from '../stores/recipeStore';
|
||||
import { buildOverviewFromServer } from '$lib/data/recipeService';
|
||||
import { auth } from '../client/firebase';
|
||||
|
|
@ -103,18 +105,48 @@ const handlers: Record<string, (payload: any) => void> = {
|
|||
// know type
|
||||
switch (extp) {
|
||||
case 'matset':
|
||||
let curr_mat_query = get(materialFromServerQuery);
|
||||
let curr_mat_query = get(materialFromServerQuery) ?? [];
|
||||
|
||||
if (!curr_mat_query) {
|
||||
curr_mat_query = [];
|
||||
}
|
||||
|
||||
// ex_payload has chunks of material setting
|
||||
for (let m of ex_payload) {
|
||||
let mid = m.id;
|
||||
curr_mat_query[mid] = m;
|
||||
// curr_mat_query[mid] = m;
|
||||
|
||||
curr_mat_query.push(m);
|
||||
}
|
||||
|
||||
// console.log('current materials: ', JSON.stringify(curr_mat_query));
|
||||
materialFromServerQuery.set(curr_mat_query);
|
||||
break;
|
||||
case 'topplist':
|
||||
let curr_topping_list_query = get(toppingListFromServerQuery) ?? [];
|
||||
if (!curr_topping_list_query) {
|
||||
curr_topping_list_query = [];
|
||||
}
|
||||
|
||||
for (let t of ex_payload) {
|
||||
curr_topping_list_query.push(t);
|
||||
}
|
||||
|
||||
toppingListFromServerQuery.set(curr_topping_list_query);
|
||||
|
||||
break;
|
||||
case 'toppgrp':
|
||||
let curr_topping_group_query = get(toppingGroupFromServerQuery) ?? [];
|
||||
if (!curr_topping_group_query) {
|
||||
curr_topping_group_query = [];
|
||||
}
|
||||
|
||||
for (let t of ex_payload) {
|
||||
curr_topping_group_query.push(t);
|
||||
}
|
||||
|
||||
toppingGroupFromServerQuery.set(curr_topping_group_query);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export function sendMessage(msg: OutMessage): boolean {
|
|||
currentQueue.push(data);
|
||||
queue.set(currentQueue);
|
||||
|
||||
addNotification('WARN:Queuing overview view request');
|
||||
addNotification('WARN:Queuing request');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,19 @@ export const recipeFromMachineLoading = writable(false);
|
|||
export const recipeFromMachineError = writable<string | null>(null);
|
||||
|
||||
export const recipeFromServerQuery = writable<any>({});
|
||||
export const materialFromServerQuery = writable<any>({});
|
||||
export const materialFromServerQuery = writable<any>([]);
|
||||
export const toppingListFromServerQuery = writable<any>([]);
|
||||
export const toppingGroupFromServerQuery = writable<any>([]);
|
||||
|
||||
// latest recipe data (use for interacting)
|
||||
export const latestRecipeToppingData = writable<any>([]);
|
||||
|
||||
// edit data update
|
||||
export const recipeDataEvent = writable<{
|
||||
event_type: string;
|
||||
payload: any;
|
||||
index: number | undefined;
|
||||
} | null>(null);
|
||||
|
||||
// NOTE: must not have any nested structures
|
||||
// { recipe: {}, materials: {}, toppings: { groups: {}, lists: {} } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue