This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
gitgram-ai/gitgram/web/components/BlockUserModal.tsx
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

101 lines
3.3 KiB
TypeScript

'use client'
import { useState } from 'react'
import api from '@/services/api'
import { useToast } from '@/components/ui/toast'
interface BlockUserModalProps {
isOpen: boolean
onClose: () => void
username: string
userId: string
onBlocked?: () => void
}
export function BlockUserModal({ isOpen, onClose, username, userId, onBlocked }: BlockUserModalProps) {
const [blocking, setBlocking] = useState(false)
const { showToast } = useToast()
const handleClose = () => {
if (!blocking) onClose()
}
const handleBlock = async () => {
setBlocking(true)
try {
await api.post('/v1/privacy/block', { userId })
showToast(`@${username} has been blocked`, 'success')
onBlocked?.()
onClose()
} catch (err: unknown) {
const axiosError = err as { response?: { data?: { message?: string; error?: { message?: string } } } }
const message =
axiosError.response?.data?.error?.message ||
axiosError.response?.data?.message ||
'Failed to block user. Please try again.'
showToast(message, 'error')
} finally {
setBlocking(false)
}
}
if (!isOpen) return null
return (
<div
className="fixed inset-0 z-50 flex items-center justify-center p-4"
role="dialog"
aria-modal="true"
aria-labelledby="block-modal-title"
>
{/* Backdrop */}
<div
className="absolute inset-0 bg-black/70 backdrop-blur-sm"
onClick={handleClose}
aria-hidden="true"
/>
{/* Modal panel */}
<div className="relative w-full max-w-sm bg-[var(--surface)] border border-[var(--border)] rounded-xl shadow-2xl overflow-hidden">
{/* Header */}
<div className="px-5 pt-5 pb-4">
<div className="w-12 h-12 rounded-full bg-[var(--error)]/15 flex items-center justify-center mb-4">
<svg className="w-6 h-6 text-[var(--error)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"
/>
</svg>
</div>
<h2 id="block-modal-title" className="text-base font-semibold text-[var(--foreground)] mb-1">
Block @{username}?
</h2>
<p className="text-sm text-[var(--foreground-secondary)]">
They won&apos;t be able to see your content, follow you, or send you messages.
</p>
</div>
{/* Actions */}
<div className="flex gap-3 px-5 pb-5">
<button
onClick={handleClose}
disabled={blocking}
className="flex-1 py-2 text-sm border border-[var(--border)] text-[var(--foreground-secondary)] rounded-lg hover:bg-[var(--surface-secondary)] disabled:opacity-40 transition-colors"
>
Cancel
</button>
<button
onClick={handleBlock}
disabled={blocking}
className="flex-1 py-2 text-sm bg-[var(--error)] text-white rounded-lg hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed transition-opacity"
>
{blocking ? 'Blocking...' : 'Block'}
</button>
</div>
</div>
</div>
)
}