diff --git a/.husky/pre-commit b/.husky/pre-commit index 086ccf6b7..1e2076363 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,6 @@ make golangci-lint ./node_modules/.bin/lint-staged +pnpm run knip cd js/app && pnpm run check unformatted=$(gofmt -l $(find . -name "*.go")) diff --git a/js/app/components/mobile/report-modal.tsx b/js/app/components/mobile/report-modal.tsx deleted file mode 100644 index a98a79762..000000000 --- a/js/app/components/mobile/report-modal.tsx +++ /dev/null @@ -1,195 +0,0 @@ -import { - ComAtprotoModerationCreateReport, - ComAtprotoModerationDefs, -} from "@atproto/api"; -import { - Button, - Dialog, - DialogFooter, - ModalContent, - Text, - Textarea, - useSubmitReport, - zero, -} from "@streamplace/components"; -import { CheckCircle, Circle, Loader2 } from "lucide-react-native"; -import React, { useState } from "react"; -import { TouchableOpacity, View } from "react-native"; - -// AT Protocol moderation reason types with proper labels -const REPORT_REASONS = [ - { - value: ComAtprotoModerationDefs.REASONSPAM, - label: "Spam", - description: "Excessive unwanted promotion, replies, mentions", - }, - { - value: ComAtprotoModerationDefs.REASONVIOLATION, - label: "Rule Violation", - description: "Direct, blatant violation of laws or terms of service", - }, - { - value: ComAtprotoModerationDefs.REASONMISLEADING, - label: "Misleading Content", - description: "Misleading identity, affiliation, or content", - }, - { - value: ComAtprotoModerationDefs.REASONSEXUAL, - label: "Sexual Content", - description: "Unwanted or mislabeled sexual content", - }, - { - value: ComAtprotoModerationDefs.REASONRUDE, - label: "Harassment", - description: "Rude, harassing, explicit, or otherwise unwelcoming behavior", - }, - { - value: ComAtprotoModerationDefs.REASONOTHER, - label: "Other", - description: "Reports not falling under another report category", - }, -]; - -interface ReportModalProps { - open: boolean; - onOpenChange: (open: boolean) => void; - onSubmit?: (reason: string, additionalComments?: string) => void; - subject: ComAtprotoModerationCreateReport.InputSchema["subject"]; - title?: string; - description?: string; -} - -export const ReportModal: React.FC = ({ - open, - onOpenChange, - onSubmit, - subject, - title = "Report", - description = "Why are you submitting this report?", -}) => { - const [selectedReason, setSelectedReason] = useState(null); - const [additionalComments, setAdditionalComments] = useState(""); - const [isSubmitting, setIsSubmitting] = useState(false); - const [submitError, setSubmitError] = useState(null); - - const submitReport = useSubmitReport(); - - const handleCancel = () => { - setSelectedReason(null); - setAdditionalComments(""); - setSubmitError(null); - onOpenChange(false); - }; - - const handleSubmit = async () => { - if (!selectedReason) return; - - setIsSubmitting(true); - setSubmitError(null); - - try { - submitReport( - subject, - selectedReason, - additionalComments.trim() || undefined, - ); - - // Reset form and close modal on success - setSelectedReason(null); - setAdditionalComments(""); - onOpenChange(false); - } catch (error) { - console.error("Failed to submit report:", error); - setSubmitError("Failed to submit report. Please try again."); - } finally { - setIsSubmitting(false); - } - }; - - return ( - - - {REPORT_REASONS.map((reason) => ( - setSelectedReason(reason.value)} - style={[ - zero.layout.flex.row, - zero.gap.all[2], - zero.py[3], - zero.px[3], - zero.borderRadius[8], - zero.layout.flex.alignCenter, - selectedReason === reason.value && { - backgroundColor: "rgba(0, 122, 255, 0.1)", - }, - ]} - > - - {selectedReason === reason.value ? : } - - - {reason.label} - - {reason.description} - - - - ))} - - - Additional Comments (optional) -