mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-11-02 18:19:44 +00:00
Add MCP server and enhance AI content tools
Implement self-hosted MCP server for admin actions, update AI generation tools in admin dashboard, and refine mobile app stores and components.
This commit is contained in:
1 parent
b0f1700e40
commit
4e40b92b16
71 files changed
+10511
-1008
No files matched your search
@@ -45,36 +45,47 @@ export const usePacksStore = create<PacksState>((set, get) => ({
|
||||
const maxIntensity = getUserMaxIntensity();
|
||||
|
||||
|
||||
// Fetch categories
|
||||
const { data: categories } = await supabase
|
||||
.from("categories")
|
||||
.select("*")
|
||||
.order("sort_order");
|
||||
|
||||
// Fetch packs with category info and question count
|
||||
let query = supabase
|
||||
.from("question_packs")
|
||||
.select("*, category:categories(*), questions(count)")
|
||||
.eq("is_public", true)
|
||||
.order("sort_order");
|
||||
|
||||
// Fetch categories
|
||||
const { data: categories } = await supabase
|
||||
.from("categories")
|
||||
.select("*")
|
||||
.order("sort_order");
|
||||
|
||||
// Hide categories explicitly marked non-public, but keep null for compatibility.
|
||||
const visibleCategories = (categories ?? []).filter(category => category.is_public !== false);
|
||||
const visibleCategoryIds = new Set(visibleCategories.map(category => category.id));
|
||||
|
||||
// Fetch packs with category info and question count
|
||||
let query = supabase
|
||||
.from("question_packs")
|
||||
.select("*, category:categories(*), questions(count)")
|
||||
.eq("is_public", true)
|
||||
.order("sort_order");
|
||||
|
||||
// Filter out packs above user's intensity preference
|
||||
if (maxIntensity < 5) {
|
||||
query = query.or(`max_intensity.is.null,max_intensity.lte.${maxIntensity}`);
|
||||
}
|
||||
|
||||
|
||||
const { data: packs } = await query;
|
||||
|
||||
// Also fetch enabled packs if logged in
|
||||
await get().fetchEnabledPacks();
|
||||
|
||||
set({
|
||||
packs: packs ?? [],
|
||||
categories: categories ?? [],
|
||||
isLoading: false
|
||||
});
|
||||
},
|
||||
const { data: packs } = await query;
|
||||
|
||||
const visiblePacks = (packs ?? []).filter(pack => {
|
||||
if (pack.category?.is_public === false) return false;
|
||||
if (pack.category_id && visibleCategoryIds.size > 0 && !visibleCategoryIds.has(pack.category_id)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// Also fetch enabled packs if logged in
|
||||
await get().fetchEnabledPacks();
|
||||
|
||||
set({
|
||||
packs: visiblePacks,
|
||||
categories: visibleCategories,
|
||||
isLoading: false
|
||||
});
|
||||
},
|
||||
|
||||
fetchEnabledPacks: async () => {
|
||||
const coupleId = useAuthStore.getState().user?.couple_id;
|
||||
|
||||
Reference in new issue
Block a user