feat: refine content calendar experience

This commit is contained in:
2026-05-05 23:25:58 -04:00
parent b66c10b681
commit a7535d460d
72 changed files with 3233 additions and 1310 deletions

View File

@@ -128,6 +128,29 @@ export const useCalendarIntegrationsStore = defineStore('calendar-integrations',
}
}
async function updateSource(sourceId, payload) {
if (!sourceId) {
return null;
}
error.value = null;
try {
const response = await client.put(`/api/calendar-integrations/sources/${sourceId}`, payload);
const updatedSource = response.data;
if (updatedSource) {
sources.value = sources.value.map(source =>
source.id === updatedSource.id ? updatedSource : source
);
}
return updatedSource;
} catch (updateError) {
console.error('Failed to update calendar source:', updateError);
error.value = 'Failed to update calendar source.';
throw updateError;
}
}
async function refreshSource(sourceId) {
if (!sourceId) {
return null;
@@ -176,6 +199,7 @@ export const useCalendarIntegrationsStore = defineStore('calendar-integrations',
fetchEvents,
searchCatalog,
createSource,
updateSource,
refreshSource,
toggleSourceVisibility,
};

View File

@@ -129,11 +129,8 @@ export const useContentItemDetailStore = defineStore('content-item-detail', () =
actions.comment = true;
try {
const response = await client.post('/api/comments', {
...payload,
contentItemId,
workspaceId: currentItemWorkspaceId(),
});
const requestPayload = buildCommentPayload(contentItemId, payload);
const response = await client.post('/api/comments', requestPayload);
if (response.data) {
comments.value = [...comments.value, response.data];
await fetchActivity(contentItemId);
@@ -144,6 +141,22 @@ export const useContentItemDetailStore = defineStore('content-item-detail', () =
}
}
function buildCommentPayload(contentItemId, payload) {
const workspaceId = currentItemWorkspaceId();
const formData = new FormData();
formData.append('workspaceId', workspaceId);
formData.append('contentItemId', contentItemId);
formData.append('body', payload.body ?? '');
if (payload.parentCommentId) {
formData.append('parentCommentId', payload.parentCommentId);
}
if (payload.mediaFile) {
formData.append('attachment', payload.mediaFile, payload.mediaFile.name || 'comment-attachment');
}
return formData;
}
async function submitDecision(contentItemId, approvalId, payload) {
actions.decision = true;