feat: bulk delete, team dispatch, calendar views, timeline colors
All checks were successful
Deploy / deploy (push) Successful in 11s
All checks were successful
Deploy / deploy (push) Successful in 11s
- Multi-select bulk delete in all 5 list views (Artefacts, Posts, Tasks, Issues, Assets) with cascade deletes and confirmation modals - Team-based issue dispatch: team picker on public issue form, team filter on Issues page, copy public link from Team page and Issues header, team assignment in IssueDetailPanel - Month/Week toggle on PostCalendar and TaskCalendarView - Month/Week/Day zoom on project and campaign timelines (InteractiveTimeline) and ProjectDetail GanttView, with Month as default - Custom timeline bar colors: clickable color dot with 12-color palette popover on project, campaign, and task timeline bars - Artefacts default view changed to list - BulkSelectBar reusable component - i18n keys for all new features (en + ar) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { CheckCircle, XCircle, AlertCircle, FileText, Image as ImageIcon, Film, Sparkles, Globe, User } from 'lucide-react'
|
||||
import { useLanguage } from '../i18n/LanguageContext'
|
||||
import { useToast } from '../components/ToastContainer'
|
||||
import Modal from '../components/Modal'
|
||||
|
||||
const STATUS_ICONS = {
|
||||
copy: FileText,
|
||||
@@ -11,6 +14,8 @@ const STATUS_ICONS = {
|
||||
|
||||
export default function PublicReview() {
|
||||
const { token } = useParams()
|
||||
const { t } = useLanguage()
|
||||
const toast = useToast()
|
||||
const [artefact, setArtefact] = useState(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState('')
|
||||
@@ -19,6 +24,7 @@ export default function PublicReview() {
|
||||
const [reviewerName, setReviewerName] = useState('')
|
||||
const [feedback, setFeedback] = useState('')
|
||||
const [selectedLanguage, setSelectedLanguage] = useState(0)
|
||||
const [pendingAction, setPendingAction] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
loadArtefact()
|
||||
@@ -29,7 +35,7 @@ export default function PublicReview() {
|
||||
const res = await fetch(`/api/public/review/${token}`)
|
||||
if (!res.ok) {
|
||||
const err = await res.json()
|
||||
setError(err.error || 'Failed to load artefact')
|
||||
setError(err.error || t('review.loadFailed'))
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
@@ -40,25 +46,32 @@ export default function PublicReview() {
|
||||
setReviewerName(data.approvers[0].name)
|
||||
}
|
||||
} catch (err) {
|
||||
setError('Failed to load artefact')
|
||||
setError(t('review.loadFailed'))
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleAction = async (action) => {
|
||||
const handleAction = (action) => {
|
||||
if (!reviewerName.trim()) {
|
||||
alert('Please select or enter your name')
|
||||
toast.error(t('review.enterName'))
|
||||
return
|
||||
}
|
||||
|
||||
if (action === 'approve' && !confirm('Approve this artefact?')) return
|
||||
if (action === 'reject' && !confirm('Reject this artefact?')) return
|
||||
if (action === 'revision' && !feedback.trim()) {
|
||||
alert('Please provide feedback for revision request')
|
||||
toast.error(t('review.feedbackRequired'))
|
||||
return
|
||||
}
|
||||
|
||||
if (action === 'approve' || action === 'reject') {
|
||||
setPendingAction(action)
|
||||
return
|
||||
}
|
||||
|
||||
executeAction(action)
|
||||
}
|
||||
|
||||
const executeAction = async (action) => {
|
||||
setSubmitting(true)
|
||||
try {
|
||||
const res = await fetch(`/api/public/review/${token}/${action}`, {
|
||||
@@ -72,18 +85,18 @@ export default function PublicReview() {
|
||||
|
||||
if (!res.ok) {
|
||||
const err = await res.json()
|
||||
setError(err.error || 'Action failed')
|
||||
setError(err.error || t('review.actionFailed'))
|
||||
setSubmitting(false)
|
||||
return
|
||||
}
|
||||
|
||||
const data = await res.json()
|
||||
setSuccess(data.message || 'Action completed successfully')
|
||||
setSuccess(data.message || t('review.actionCompleted'))
|
||||
setTimeout(() => {
|
||||
loadArtefact()
|
||||
}, 1500)
|
||||
} catch (err) {
|
||||
setError('Action failed')
|
||||
setError(t('review.actionFailed'))
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
}
|
||||
@@ -133,7 +146,7 @@ export default function PublicReview() {
|
||||
<div className="w-16 h-16 rounded-full bg-red-100 flex items-center justify-center mx-auto mb-4">
|
||||
<XCircle className="w-8 h-8 text-red-600" />
|
||||
</div>
|
||||
<h2 className="text-2xl font-bold text-text-primary mb-2">Review Not Available</h2>
|
||||
<h2 className="text-2xl font-bold text-text-primary mb-2">{t('review.notAvailable')}</h2>
|
||||
<p className="text-text-secondary">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,7 +160,7 @@ export default function PublicReview() {
|
||||
<div className="w-16 h-16 rounded-full bg-emerald-100 flex items-center justify-center mx-auto mb-4">
|
||||
<CheckCircle className="w-8 h-8 text-emerald-600" />
|
||||
</div>
|
||||
<h2 className="text-2xl font-bold text-text-primary mb-2">Thank You!</h2>
|
||||
<h2 className="text-2xl font-bold text-text-primary mb-2">{t('review.thankYou')}</h2>
|
||||
<p className="text-text-secondary">{success}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -170,7 +183,7 @@ export default function PublicReview() {
|
||||
<Sparkles className="w-6 h-6 text-white" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-white">Content Review</h1>
|
||||
<h1 className="text-2xl font-bold text-white">{t('review.contentReview')}</h1>
|
||||
<p className="text-white/80 text-sm">Samaya Digital Hub</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -190,7 +203,7 @@ export default function PublicReview() {
|
||||
<div className="flex items-center gap-3 text-sm text-text-tertiary">
|
||||
<span className="px-2 py-0.5 bg-surface-tertiary rounded-full capitalize">{artefact.type}</span>
|
||||
{artefact.brand_name && <span>• {artefact.brand_name}</span>}
|
||||
{artefact.version_number && <span>• Version {artefact.version_number}</span>}
|
||||
{artefact.version_number && <span>• {t('review.version')} {artefact.version_number}</span>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -200,7 +213,7 @@ export default function PublicReview() {
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<Globe className="w-4 h-4 text-text-tertiary" />
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase">Content Languages</h3>
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase">{t('review.contentLanguages')}</h3>
|
||||
</div>
|
||||
|
||||
{/* Language tabs */}
|
||||
@@ -226,7 +239,7 @@ export default function PublicReview() {
|
||||
{/* Selected language content */}
|
||||
<div className="bg-surface-secondary rounded-xl p-6 border border-border">
|
||||
<div className="mb-2 text-xs font-semibold text-text-tertiary uppercase">
|
||||
{artefact.texts[selectedLanguage].language_label} Content
|
||||
{artefact.texts[selectedLanguage].language_label} {t('review.content')}
|
||||
</div>
|
||||
<div className="text-text-primary whitespace-pre-wrap leading-relaxed">
|
||||
{artefact.texts[selectedLanguage].content}
|
||||
@@ -238,7 +251,7 @@ export default function PublicReview() {
|
||||
{/* Legacy content field (for backward compatibility) */}
|
||||
{artefact.content && (!artefact.texts || artefact.texts.length === 0) && (
|
||||
<div className="mb-6">
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase mb-2">Content</h3>
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase mb-2">{t('review.content')}</h3>
|
||||
<div className="bg-surface-secondary rounded-xl p-4 border border-border">
|
||||
<pre className="text-text-primary whitespace-pre-wrap font-sans text-sm leading-relaxed">
|
||||
{artefact.content}
|
||||
@@ -252,7 +265,7 @@ export default function PublicReview() {
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<ImageIcon className="w-4 h-4 text-text-tertiary" />
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase">Design Files</h3>
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase">{t('review.designFiles')}</h3>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{artefact.attachments.map((att, idx) => (
|
||||
@@ -284,7 +297,7 @@ export default function PublicReview() {
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<Film className="w-4 h-4 text-text-tertiary" />
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase">Videos</h3>
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase">{t('review.videos')}</h3>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
{artefact.attachments.map((att, idx) => (
|
||||
@@ -293,7 +306,7 @@ export default function PublicReview() {
|
||||
<div>
|
||||
<div className="px-4 py-2 bg-surface border-b border-border flex items-center gap-2">
|
||||
<Globe className="w-4 h-4 text-text-tertiary" />
|
||||
<span className="text-sm font-medium text-text-secondary">Google Drive Video</span>
|
||||
<span className="text-sm font-medium text-text-secondary">{t('review.googleDriveVideo')}</span>
|
||||
</div>
|
||||
<iframe
|
||||
src={getDriveEmbedUrl(att.drive_url)}
|
||||
@@ -325,7 +338,7 @@ export default function PublicReview() {
|
||||
{/* OTHER TYPE: Generic Attachments */}
|
||||
{artefact.type === 'other' && artefact.attachments && artefact.attachments.length > 0 && (
|
||||
<div className="mb-6">
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase mb-3">Attachments</h3>
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase mb-3">{t('review.attachments')}</h3>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
{artefact.attachments.map((att, idx) => (
|
||||
<div key={idx}>
|
||||
@@ -372,7 +385,7 @@ export default function PublicReview() {
|
||||
{/* Comments */}
|
||||
{artefact.comments && artefact.comments.length > 0 && (
|
||||
<div className="mb-6">
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase mb-3">Previous Comments</h3>
|
||||
<h3 className="text-sm font-semibold text-text-tertiary uppercase mb-3">{t('review.previousComments')}</h3>
|
||||
<div className="space-y-3">
|
||||
{artefact.comments.map((comment, idx) => (
|
||||
<div key={idx} className="bg-surface-secondary rounded-lg p-3 border border-border">
|
||||
@@ -396,12 +409,12 @@ export default function PublicReview() {
|
||||
{/* Review Form */}
|
||||
{artefact.status === 'pending_review' && (
|
||||
<div className="border-t border-border pt-6">
|
||||
<h3 className="text-lg font-semibold text-text-primary mb-4">Your Review</h3>
|
||||
<h3 className="text-lg font-semibold text-text-primary mb-4">{t('review.yourReview')}</h3>
|
||||
|
||||
<div className="space-y-4 mb-6">
|
||||
{/* Reviewer identity */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-text-primary mb-1">Reviewer</label>
|
||||
<label className="block text-sm font-medium text-text-primary mb-1">{t('review.reviewer')}</label>
|
||||
{artefact.approvers?.length === 1 ? (
|
||||
<div className="flex items-center gap-2 px-4 py-2 bg-surface-secondary border border-border rounded-lg">
|
||||
<User className="w-4 h-4 text-text-tertiary" />
|
||||
@@ -413,7 +426,7 @@ export default function PublicReview() {
|
||||
onChange={e => setReviewerName(e.target.value)}
|
||||
className="w-full px-4 py-2 text-sm border border-border rounded-lg bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary transition-colors"
|
||||
>
|
||||
<option value="">Select your name...</option>
|
||||
<option value="">{t('review.selectYourName')}</option>
|
||||
{artefact.approvers.map(a => (
|
||||
<option key={a.id} value={a.name}>{a.name}</option>
|
||||
))}
|
||||
@@ -423,19 +436,19 @@ export default function PublicReview() {
|
||||
type="text"
|
||||
value={reviewerName}
|
||||
onChange={e => setReviewerName(e.target.value)}
|
||||
placeholder="Enter your name"
|
||||
placeholder={t('review.enterYourName')}
|
||||
className="w-full px-4 py-2 text-sm border border-border rounded-lg bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary transition-colors"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-text-primary mb-1">Feedback (optional)</label>
|
||||
<label className="block text-sm font-medium text-text-primary mb-1">{t('review.feedbackOptional')}</label>
|
||||
<textarea
|
||||
value={feedback}
|
||||
onChange={e => setFeedback(e.target.value)}
|
||||
rows={4}
|
||||
placeholder="Share your thoughts, suggestions, or required changes..."
|
||||
placeholder={t('review.feedbackPlaceholder')}
|
||||
className="w-full px-4 py-2 text-sm border border-border rounded-lg bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-brand-primary/20 focus:border-brand-primary transition-colors"
|
||||
/>
|
||||
</div>
|
||||
@@ -448,7 +461,7 @@ export default function PublicReview() {
|
||||
className="flex items-center justify-center gap-2 px-4 py-3 bg-emerald-600 text-white rounded-xl font-medium hover:bg-emerald-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed shadow-sm"
|
||||
>
|
||||
<CheckCircle className="w-5 h-5" />
|
||||
Approve
|
||||
{t('review.approve')}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleAction('revision')}
|
||||
@@ -456,7 +469,7 @@ export default function PublicReview() {
|
||||
className="flex items-center justify-center gap-2 px-4 py-3 bg-amber-500 text-white rounded-xl font-medium hover:bg-amber-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed shadow-sm"
|
||||
>
|
||||
<AlertCircle className="w-5 h-5" />
|
||||
Request Revision
|
||||
{t('review.requestRevision')}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleAction('reject')}
|
||||
@@ -464,7 +477,7 @@ export default function PublicReview() {
|
||||
className="flex items-center justify-center gap-2 px-4 py-3 bg-red-600 text-white rounded-xl font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed shadow-sm"
|
||||
>
|
||||
<XCircle className="w-5 h-5" />
|
||||
Reject
|
||||
{t('review.reject')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -475,14 +488,14 @@ export default function PublicReview() {
|
||||
<div className="border-t border-border pt-6">
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-xl p-4 text-center">
|
||||
<p className="text-blue-900 font-medium">
|
||||
This artefact has already been reviewed.
|
||||
{t('review.alreadyReviewed')}
|
||||
</p>
|
||||
<p className="text-blue-700 text-sm mt-1">
|
||||
Status: <span className="font-semibold capitalize">{artefact.status.replace('_', ' ')}</span>
|
||||
{t('review.statusLabel')}: <span className="font-semibold capitalize">{artefact.status.replace('_', ' ')}</span>
|
||||
</p>
|
||||
{artefact.approved_by_name && (
|
||||
<p className="text-blue-700 text-sm mt-1">
|
||||
Reviewed by: <span className="font-semibold">{artefact.approved_by_name}</span>
|
||||
{t('review.reviewedBy')}: <span className="font-semibold">{artefact.approved_by_name}</span>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -493,9 +506,26 @@ export default function PublicReview() {
|
||||
|
||||
{/* Footer */}
|
||||
<div className="text-center text-text-tertiary text-sm">
|
||||
<p>Powered by Samaya Digital Hub</p>
|
||||
<p>{t('review.poweredBy')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Approve / Reject Confirmation */}
|
||||
<Modal
|
||||
isOpen={!!pendingAction}
|
||||
onClose={() => setPendingAction(null)}
|
||||
title={pendingAction === 'approve' ? t('review.confirmApprove') : t('review.confirmReject')}
|
||||
isConfirm
|
||||
danger={pendingAction === 'reject'}
|
||||
onConfirm={() => {
|
||||
const action = pendingAction
|
||||
setPendingAction(null)
|
||||
executeAction(action)
|
||||
}}
|
||||
confirmText={pendingAction === 'approve' ? t('review.approve') : t('review.reject')}
|
||||
>
|
||||
{pendingAction === 'approve' ? t('review.confirmApproveDesc') : t('review.confirmRejectDesc')}
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user