mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 20:09:41 +02:00
fix(memoro/web): replace $user with authStore.user (Svelte 5 runes)
Old $user store subscription references caused build failure in runes mode. Replaced with authStore.user across 6 files (tags, upload, record, memos, MemoPanel, Sidebar). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
99878472e1
commit
6d5d5283b7
6 changed files with 23 additions and 19 deletions
|
|
@ -528,7 +528,7 @@
|
|||
{#if !isMinimized}
|
||||
<!-- User Email -->
|
||||
<div class="mb-2 px-3 py-2 text-xs text-theme-muted truncate">
|
||||
{$user?.email || ''}
|
||||
{authStore.user?.email || ''}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,11 +145,11 @@
|
|||
});
|
||||
|
||||
async function loadTags() {
|
||||
if (!$user) return;
|
||||
if (!authStore.user) return;
|
||||
|
||||
try {
|
||||
isLoadingTags = true;
|
||||
const tags = await tagService.getTags($user.id);
|
||||
const tags = await tagService.getTags(authStore.user.id);
|
||||
availableTags = tags;
|
||||
tagsStore.setTags(tags);
|
||||
} catch (err) {
|
||||
|
|
@ -369,10 +369,10 @@
|
|||
}
|
||||
|
||||
async function handleCreateTag(name: string, color: string) {
|
||||
if (!$user) return;
|
||||
if (!authStore.user) return;
|
||||
|
||||
try {
|
||||
const newTag = await tagService.createTag($user.id, name, color);
|
||||
const newTag = await tagService.createTag(authStore.user.id, name, color);
|
||||
availableTags = [...availableTags, newTag];
|
||||
tagsStore.setTags(availableTags);
|
||||
} catch (err) {
|
||||
|
|
|
|||
|
|
@ -146,13 +146,13 @@
|
|||
|
||||
// Load more memos for infinite scroll
|
||||
async function loadMoreMemos() {
|
||||
if ($isLoadingMore || !$hasMoreMemos || !$user) return;
|
||||
if ($isLoadingMore || !$hasMoreMemos || !authStore.user) return;
|
||||
|
||||
isLoadingMore.set(true);
|
||||
try {
|
||||
const newOffset = $currentOffset + MEMOS_PER_PAGE;
|
||||
const { memos: newMemos, hasMore } = await memoService.getMemosForList(
|
||||
$user.id,
|
||||
authStore.user.id,
|
||||
MEMOS_PER_PAGE,
|
||||
newOffset
|
||||
);
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
currentOffset.set(0);
|
||||
|
||||
try {
|
||||
if (!$user) {
|
||||
if (!authStore.user) {
|
||||
error = $t('memo.error_user_not_authenticated');
|
||||
loading = false;
|
||||
return;
|
||||
|
|
@ -182,8 +182,8 @@
|
|||
|
||||
// Load memos and tags in parallel using optimized list query
|
||||
const [memosResult, tagsData] = await Promise.all([
|
||||
memoService.getMemosForList($user.id, MEMOS_PER_PAGE, 0),
|
||||
tagService.getTags($user.id),
|
||||
memoService.getMemosForList(authStore.user.id, MEMOS_PER_PAGE, 0),
|
||||
tagService.getTags(authStore.user.id),
|
||||
]);
|
||||
|
||||
memos.setMemos(memosResult.memos);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
|
||||
async function handleRecordingComplete(audioBlob: Blob) {
|
||||
if (!$user) {
|
||||
if (!authStore.user) {
|
||||
console.error('No user authenticated');
|
||||
recording.setError($t('record.user_not_authenticated'));
|
||||
return;
|
||||
|
|
@ -31,12 +31,12 @@
|
|||
console.log('Uploading recording:', {
|
||||
blobSize: audioBlob.size,
|
||||
duration: audioDuration,
|
||||
userId: $user.id,
|
||||
userId: authStore.user.id,
|
||||
});
|
||||
|
||||
const result = await uploadAndProcessAudio({
|
||||
audioBlob,
|
||||
userId: $user.id,
|
||||
userId: authStore.user.id,
|
||||
title: 'New Recording',
|
||||
duration: audioDuration,
|
||||
spaceId: null,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
// Load tags and usage counts on mount
|
||||
onMount(async () => {
|
||||
if (!$user) {
|
||||
if (!authStore.user) {
|
||||
loadError = 'User not authenticated';
|
||||
isLoadingTags = false;
|
||||
return;
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
isLoadingTags = true;
|
||||
loadError = null;
|
||||
|
||||
const loadedTags = await tagService.getTags($user!.id);
|
||||
const loadedTags = await tagService.getTags(authStore.user!.id);
|
||||
tags.setTags(loadedTags);
|
||||
|
||||
// Load usage counts for all tags
|
||||
|
|
@ -86,13 +86,17 @@
|
|||
|
||||
async function handleCreateTag(event: Event) {
|
||||
event.preventDefault();
|
||||
if (!$user || !newTagName.trim()) return;
|
||||
if (!authStore.user || !newTagName.trim()) return;
|
||||
|
||||
try {
|
||||
isCreatingTag = true;
|
||||
actionError = null;
|
||||
|
||||
const createdTag = await tagService.createTag($user.id, newTagName.trim(), newTagColor);
|
||||
const createdTag = await tagService.createTag(
|
||||
authStore.user.id,
|
||||
newTagName.trim(),
|
||||
newTagColor
|
||||
);
|
||||
|
||||
// Optimistic UI update
|
||||
tags.addTag(createdTag);
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
|
||||
// Upload file
|
||||
async function handleUpload() {
|
||||
if (!selectedFile || !$user) return;
|
||||
if (!selectedFile || !authStore.user) return;
|
||||
|
||||
try {
|
||||
uploading = true;
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
// Upload and process
|
||||
const result = await uploadAndProcessAudio({
|
||||
audioBlob: selectedFile,
|
||||
userId: $user.id,
|
||||
userId: authStore.user.id,
|
||||
title: title || 'Uploaded Recording',
|
||||
duration,
|
||||
blueprintId: selectedBlueprint,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue