Moved later/gitgram-ai/gitgram/ to apps/ritgram/ (fresh history; full history stays in caelum0x/gitgram). AITimeMachine stays separate in later/gitgram-ai per the Rithub master plan. Logs, pid files and env files are ignored; GPL-3.0 mobile/proximity noted in THIRD_PARTY_NOTICES. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
'use client'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
import {
|
|
buildRepoTextPath,
|
|
buildRepoTextRawPath,
|
|
} from '@/utils/repositoryRouting'
|
|
|
|
interface RepoTextQuickActionsProps {
|
|
owner: string
|
|
name: string
|
|
className?: string
|
|
buttonClassName?: string
|
|
rawButtonClassName?: string
|
|
}
|
|
|
|
export default function RepoTextQuickActions({
|
|
owner,
|
|
name,
|
|
className = '',
|
|
buttonClassName = '',
|
|
rawButtonClassName = '',
|
|
}: RepoTextQuickActionsProps) {
|
|
const router = useRouter()
|
|
|
|
const baseButtonClassName =
|
|
'rounded-md border px-2.5 py-1 text-[11px] font-semibold transition'
|
|
|
|
const handleTextClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
event.preventDefault()
|
|
event.stopPropagation()
|
|
router.push(buildRepoTextPath(owner, name))
|
|
}
|
|
|
|
const handleRawClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
event.preventDefault()
|
|
event.stopPropagation()
|
|
window.open(buildRepoTextRawPath(owner, name), '_blank', 'noopener,noreferrer')
|
|
}
|
|
|
|
return (
|
|
<div className={`flex items-center gap-2 ${className}`}>
|
|
<button
|
|
type="button"
|
|
onClick={handleTextClick}
|
|
className={`${baseButtonClassName} ${buttonClassName}`}
|
|
>
|
|
Text
|
|
</button>
|
|
<button
|
|
type="button"
|
|
onClick={handleRawClick}
|
|
className={`${baseButtonClassName} ${rawButtonClassName || buttonClassName}`}
|
|
>
|
|
Raw
|
|
</button>
|
|
</div>
|
|
)
|
|
}
|