import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { Button } from '../../ui/button.js';
import { PublishToGitHubModal } from './publish-to-github-modal.js';
const owners = [
    { login: 'octocat', kind: 'user', description: 'Your personal account' },
    { login: 'shep-ai', kind: 'org', description: 'The Shep AI organization' },
    { login: 'acme-corp', kind: 'org', description: 'ACME Corporation' },
];
const meta = {
    title: 'ApplicationPage/PublishToGitHubModal',
    component: PublishToGitHubModal,
    parameters: { layout: 'centered' },
};
export default meta;
function Wrapper({ initialOwners, startOpen = true, defaultRepoName = 'my-cool-app', failNext = false, }) {
    const [open, setOpen] = useState(startOpen);
    return (_jsxs("div", { className: "space-y-4", children: [_jsx(Button, { onClick: () => setOpen(true), children: "Open modal" }), _jsx(PublishToGitHubModal, { open: open, onOpenChange: setOpen, owners: initialOwners, defaultRepoName: defaultRepoName, onSubmit: async () => {
                    if (failNext) {
                        throw new Error('Repository "my-cool-app" already exists on octocat.');
                    }
                } })] }));
}
export const Default = {
    render: () => _jsx(Wrapper, { initialOwners: owners }),
};
export const SingleOwner = {
    render: () => _jsx(Wrapper, { initialOwners: owners.slice(0, 1), defaultRepoName: "snake-game" }),
};
export const SubmissionError = {
    render: () => _jsx(Wrapper, { initialOwners: owners, failNext: true }),
};
export const Closed = {
    render: () => _jsx(Wrapper, { initialOwners: owners, startOpen: false }),
};
