mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-26 19:37:42 +02:00
feat(feedback): public feed types + ReactionBar + service split
@mana/feedback wird zur Pflege-SSOT für Public-Community-Hub.
- PublicFeedbackItem-Typ: anonymisiertes Item, das nur display_name +
reactions + status führt — kein userId, displayHash, deviceInfo.
- ReactionEmoji ('👍' '❤️' '🚀' '🤔' '🎉') + REACTION_LABELS mit DE-Labels.
- CreateFeedbackInput erweitert um moduleContext + parentId. Reactions
+ score auf Feedback-Type optional gemacht.
- Service-Split:
createFeedbackService — auth-required Submit/React/Manage,
getPublicFeed (auth-enriched mit myReactions)
createPublicFeedbackService — anonymous, SSR-only, getFeed/getItem.
toggleReaction(emoji) statt vote/unvote (legacy-Shims bleiben für
back-compat zu vote → '👍'-Toggle).
- ReactionBar.svelte: Slack-Style emoji-row mit Active-Highlighting für
myReactions, ReadOnly-Mode für Public-SSR. Auto-disabled-Tooltip.
- index.ts re-exportiert die neuen Typen + ReactionBar; FeedbackVote
rausgeschmissen (durch FeedbackReactions im Server-Schema ersetzt).
FeedbackCard + FeedbackPage minimal angepasst, damit svelte-check
clean bleibt — die Legacy-Komponenten bleiben funktional, werden aber
in Phase 3 zu @mana/feedback's neuen Modul-Views ausgemistet.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8b0a943e71
commit
c9b122076a
9 changed files with 460 additions and 108 deletions
|
|
@ -1,8 +1,14 @@
|
|||
/**
|
||||
* API request/response types for feedback
|
||||
* API request/response types for feedback.
|
||||
*/
|
||||
|
||||
import type { Feedback, FeedbackCategory, FeedbackStatus } from './feedback';
|
||||
import type {
|
||||
Feedback,
|
||||
FeedbackCategory,
|
||||
FeedbackStatus,
|
||||
PublicFeedbackItem,
|
||||
ReactionEmoji,
|
||||
} from './feedback';
|
||||
|
||||
export interface CreateFeedbackInput {
|
||||
title?: string;
|
||||
|
|
@ -11,37 +17,66 @@ export interface CreateFeedbackInput {
|
|||
/**
|
||||
* Whether the submission shows up in the public community list.
|
||||
* Defaults to `true` server-side. Set `false` for private intake
|
||||
* categories like `onboarding-wish` or `churn-feedback`.
|
||||
* categories like `onboarding-wish` (private mode) or `churn-feedback`.
|
||||
*/
|
||||
isPublic?: boolean;
|
||||
/** Module that triggered the inline FeedbackHook submission. */
|
||||
moduleContext?: string;
|
||||
/** If set, submission is a reply to that feedback item. */
|
||||
parentId?: string;
|
||||
deviceInfo?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface FeedbackQueryParams {
|
||||
appId?: string;
|
||||
moduleContext?: string;
|
||||
status?: FeedbackStatus;
|
||||
category?: FeedbackCategory;
|
||||
sort?: 'votes' | 'recent';
|
||||
sort?: 'score' | 'recent';
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
}
|
||||
|
||||
export interface FeedbackResponse {
|
||||
success: boolean;
|
||||
success?: boolean;
|
||||
feedback?: Feedback;
|
||||
error?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface FeedbackListResponse {
|
||||
success: boolean;
|
||||
success?: boolean;
|
||||
items: Feedback[];
|
||||
total: number;
|
||||
total?: number;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface PublicFeedListResponse {
|
||||
items: PublicFeedbackItem[];
|
||||
}
|
||||
|
||||
export interface PublicItemResponse {
|
||||
item: PublicFeedbackItem;
|
||||
replies: PublicFeedbackItem[];
|
||||
}
|
||||
|
||||
export interface ReactionResponse {
|
||||
reactions: Partial<Record<string, number>>;
|
||||
score: number;
|
||||
userHasReacted: boolean;
|
||||
}
|
||||
|
||||
export interface AdminPatchInput {
|
||||
status?: FeedbackStatus;
|
||||
adminResponse?: string;
|
||||
isPublic?: boolean;
|
||||
}
|
||||
|
||||
export type ReactInput = { emoji: ReactionEmoji };
|
||||
|
||||
export interface VoteResponse {
|
||||
success: boolean;
|
||||
newVoteCount: number;
|
||||
userHasVoted: boolean;
|
||||
newVoteCount?: number;
|
||||
userHasVoted?: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue