Changeset e882b92 for chapterx-frontend
- Timestamp:
- 08/24/26 20:57:09 (13 days ago)
- Branches:
- main
- Parents:
- a6e33d1
- Location:
- chapterx-frontend/src
- Files:
-
- 6 edited
-
components/admin/ContentModerationTable.tsx (modified) (1 diff)
-
components/story/CommentSection.tsx (modified) (1 diff)
-
components/story/LikeButton.tsx (modified) (1 diff)
-
components/writer/CollaboratorManager.tsx (modified) (1 diff)
-
store/notificationStore.ts (modified) (3 diffs)
-
store/storyStore.ts (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chapterx-frontend/src/components/admin/ContentModerationTable.tsx
ra6e33d1 re882b92 20 20 deleteStory(story.story_id) 21 21 addNotification({ 22 user_id: story.user_id, 23 type: 'system', 24 title: 'Story Removed', 25 message: `Your story "${story.title}" has been removed by an administrator.`, 22 userId: story.user_id, 23 contentType: 'system', 24 content: `Your story "${story.title}" has been removed by an administrator.`, 26 25 }) 27 26 addToast(`"${story.title}" removed from platform`, 'info') -
chapterx-frontend/src/components/story/CommentSection.tsx
ra6e33d1 re882b92 80 80 if (currentUser.user_id !== authorUserId) { 81 81 await addNotification({ 82 recipientUserId: authorUserId,83 type: 'comment',82 userId: authorUserId, 83 contentType: 'comment', 84 84 content: `${currentUser.username} commented: "${text.trim().slice(0, 60)}${text.length > 60 ? '...' : ''}"`, 85 storyId, 85 86 link: `/story/${storyId}`, 86 87 }) -
chapterx-frontend/src/components/story/LikeButton.tsx
ra6e33d1 re882b92 59 59 if (currentUser.user_id !== authorUserId) { 60 60 await addNotification({ 61 recipientUserId: authorUserId,62 type: 'like',61 userId: authorUserId, 62 contentType: 'like', 63 63 content: `${currentUser.username} liked your story.`, 64 storyId, 64 65 link: `/story/${storyId}`, 65 66 }) -
chapterx-frontend/src/components/writer/CollaboratorManager.tsx
ra6e33d1 re882b92 62 62 addCollaboration(newCollab) 63 63 addNotification({ 64 recipientUserId: user.user_id,65 type: 'collaboration',64 userId: user.user_id, 65 contentType: 'collaboration', 66 66 content: `You've been invited to collaborate on "${storyTitle}" as ${selectedRole}.`, 67 storyId, 67 68 link: `/story/${storyId}`, 68 69 }) -
chapterx-frontend/src/store/notificationStore.ts
ra6e33d1 re882b92 17 17 notifications: Notification[] 18 18 fetchUserNotifications: (userId: number) => Promise<void> 19 addNotification: (n: { recipientUserId: number; type: string; content: string; link?: string }) => Promise<void>19 addNotification: (n: { userId: number; contentType: string; content: string; storyId?: number; link?: string }) => Promise<void> 20 20 markAllRead: () => Promise<void> 21 21 markRead: (id: number) => Promise<void> … … 33 33 notification_id: n.id, 34 34 user_id: userId, 35 type: n. type ?? 'info',36 title: n. type ?? 'Notification',35 type: n.contentType ?? 'info', 36 title: n.contentType ?? 'Notification', 37 37 message: n.content, 38 38 link: n.link, … … 46 46 }, 47 47 48 addNotification: async ({ recipientUserId, type, content, link }) => {48 addNotification: async ({ userId, contentType, content, storyId, link }) => { 49 49 try { 50 50 await axios.post(`${API}/notifications`, { 51 51 content, 52 recipientUserId, 53 type, 52 contentType, 53 userId, 54 storyId, 54 55 link, 55 56 }, { headers: getAuthHeaders() }) -
chapterx-frontend/src/store/storyStore.ts
ra6e33d1 re882b92 144 144 cover_image: s.image ?? undefined, 145 145 mature_content: s.matureContent, 146 status: 'published'as StoryStatus,146 status: (s.status ?? 'draft') as StoryStatus, 147 147 author_username: s.writer?.user?.username ?? '', 148 148 created_at: s.createdAt, … … 193 193 name: c.name ?? c.username ?? '', 194 194 story_title: '', 195 role: 'editor'as any,196 permission_level: 3as any,195 role: c.role as any, 196 permission_level: (c.permissionLevel ?? 3) as any, 197 197 joined_at: c.createdAt, 198 198 })) … … 246 246 image: imageUrl, 247 247 content: partial.content ?? story.content, 248 status: partial.status ?? story.status, 248 249 }, { headers: getAuthHeaders() }) 249 250 } catch { … … 266 267 }, 267 268 268 updateStoryStatus: (id, status) => 269 updateStoryStatus: (id, status) => { 269 270 set(state => ({ 270 271 stories: state.stories.map(s => 271 272 s.story_id === id ? { ...s, status, updated_at: new Date().toISOString() } : s 272 273 ), 273 })), 274 })) 275 get().updateStory(id, { status }) 276 }, 274 277 275 278 addChapter: async (chapter) => { … … 407 410 storyId: collab.story_id, 408 411 role: collab.role, 412 permissionLevel: collab.permission_level, 409 413 }, { headers: getAuthHeaders() }) 410 414 } catch { … … 445 449 original_text: s.originalText, 446 450 suggested_text: s.suggestedText, 447 suggestion_type: (s.suggestionTypes?.[0] ?? 'style') as SuggestionType, 451 suggestion_type: (s.suggestionType ?? 'style') as SuggestionType, 452 explanation: s.explanation ?? '', 448 453 accepted: s.accepted === true ? true : s.accepted === false ? false : null, 454 created_at: s.createdAt ?? new Date().toISOString(), 449 455 applied_at: s.appliedAt ?? undefined, 450 456 })) … … 506 512 originalText: suggestion.original_text, 507 513 suggestedText: suggestion.suggested_text, 514 suggestionType: suggestion.suggestion_type, 508 515 storyId: suggestion.chapter_id, 509 516 }, { headers: getAuthHeaders() })
Note:
See TracChangeset
for help on using the changeset viewer.
