CoolFace
Apppublic

admin08077/Githubgemini

sourceHugging Faceotherupdated 10mo agoView on Hugging Face
0likes
ChangelogGenerator-DJpWK4fB.js.map1 linesDownload Raw Back to assets
1{"version":3,"file":"ChangelogGenerator-DJpWK4fB.js","sources":["../../components/features/ChangelogGenerator.tsx"],"sourcesContent":["import React, { useState, useCallback } from 'react';\nimport { generateChangelogFromLogStream } from '../../services/aiService.ts';\nimport { GitBranchIcon } from '../icons.tsx';\nimport { LoadingSpinner } from '../shared/index.tsx';\nimport { MarkdownRenderer } from '../shared/index.tsx';\n\nconst exampleLog = `commit 3a4b5c...\nAuthor: Dev One <dev.one@example.com>\nDate:   Mon Jul 15 11:30:00 2024 -0400\n\n    feat: add user login page\n\ncommit 1a2b3c...\nAuthor: Dev Two <dev.two@example.com>\nDate:   Mon Jul 15 10:00:00 2024 -0400\n\n    fix: correct typo in header\n`;\n\nexport const ChangelogGenerator: React.FC = () => {\n    const [log, setLog] = useState(exampleLog);\n    const [changelog, setChangelog] = useState('');\n    const [isLoading, setIsLoading] = useState(false);\n    const [error, setError] = useState('');\n\n    const handleGenerate = useCallback(async () => {\n        if (!log.trim()) {\n            setError('Please paste your git log output.');\n            return;\n        }\n        setIsLoading(true);\n        setError('');\n        setChangelog('');\n        try {\n            const stream = generateChangelogFromLogStream(log);\n            let fullResponse = '';\n            for await (const chunk of stream) {\n                fullResponse += chunk;\n                setChangelog(fullResponse);\n            }\n        } catch (err) {\n            setError(err instanceof Error ? err.message : 'An unknown error occurred.');\n        } finally {\n            setIsLoading(false);\n        }\n    }, [log]);\n\n    return (\n        <div className=\"h-full flex flex-col p-4 sm:p-6 lg:p-8 text-text-primary\">\n            <header className=\"mb-6\">\n                <h1 className=\"text-3xl font-bold flex items-center\">\n                    <GitBranchIcon />\n                    <span className=\"ml-3\">AI Changelog Generator</span>\n                </h1>\n                <p className=\"text-text-secondary mt-1\">Generate a markdown changelog from your raw git log.</p>\n            </header>\n            <div className=\"flex-grow flex flex-col gap-4 min-h-0\">\n                <div className=\"flex flex-col flex-1 min-h-0\">\n                    <label htmlFor=\"commit-input\" className=\"text-sm font-medium text-text-secondary mb-2\">Raw Git Log</label>\n                    <textarea\n                        id=\"commit-input\"\n                        value={log}\n                        onChange={(e) => setLog(e.target.value)}\n                        className=\"flex-grow p-4 bg-surface border border-border rounded-md resize-none font-mono text-sm\"\n                    />\n                </div>\n                <div className=\"flex-shrink-0\">\n                    <button onClick={handleGenerate} disabled={isLoading} className=\"btn-primary w-full max-w-xs mx-auto flex items-center justify-center px-6 py-3\">\n                        {isLoading ? <LoadingSpinner /> : 'Generate Changelog'}\n                    </button>\n                </div>\n                <div className=\"flex flex-col flex-1 min-h-0\">\n                    <label className=\"text-sm font-medium text-text-secondary mb-2\">Generated Changelog.md</label>\n                    <div className=\"relative flex-grow p-4 bg-background border border-border rounded-md overflow-y-auto\">\n                        {isLoading && !changelog && <div className=\"flex items-center justify-center h-full\"><LoadingSpinner /></div>}\n                        {error && <p className=\"text-red-500\">{error}</p>}\n                        {changelog && <MarkdownRenderer content={changelog} />}\n                        {!isLoading && changelog && <button onClick={() => navigator.clipboard.writeText(changelog)} className=\"absolute top-2 right-2 px-2 py-1 bg-gray-100 text-xs rounded-md hover:bg-gray-200\">Copy</button>}\n                    </div>\n                </div>\n            </div>\n        </div>\n    );\n};"],"names":["exampleLog","ChangelogGenerator","log","setLog","useState","changelog","setChangelog","isLoading","setIsLoading","error","setError","handleGenerate","useCallback","stream","generateChangelogFromLogStream","fullResponse","chunk","err","jsxs","jsx","GitBranchIcon","e","LoadingSpinner","MarkdownRenderer"],"mappings":"koFAMA,MAAMA,EAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaNC,GAA+B,IAAM,CAC9C,KAAM,CAACC,EAAKC,CAAM,EAAIC,EAAAA,SAASJ,CAAU,EACnC,CAACK,EAAWC,CAAY,EAAIF,EAAAA,SAAS,EAAE,EACvC,CAACG,EAAWC,CAAY,EAA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