Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+New ideas 20241007 #7921

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/packages/frontend/i18n/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export const labels = defineMessages({
},
latex_document: {
id: "labels.latex_document",
defaultMessage: "LaTeX Document",
defaultMessage: "LaTeX",
description:
"Indicating a LaTeX Documents on a button label or frame title",
},
Expand Down Expand Up @@ -578,6 +578,10 @@ export const labels = defineMessages({
id: "labels.color",
defaultMessage: "Color",
},
create: {
id: "labels.create",
defaultMessage: "Create",
},
});

export const menu = defineMessages({
Expand Down
55 changes: 55 additions & 0 deletions src/packages/frontend/project/new/add-ai-gen-btn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: MS-RSL – see LICENSE.md for details
*/

import { Col, Flex, Space } from "antd";

import { AIGenerateDocumentButton } from "@cocalc/frontend/project/page/home-page/ai-generate-document";
import { Ext } from "@cocalc/frontend/project/page/home-page/ai-generate-examples";

interface Props {
btn: JSX.Element;
grid: [number | { flex: string }, number | { flex: string }];
filename: string | undefined;
filenameChanged?: boolean;
mode: "full" | "flyout";
ext: Ext;
}

export function AiDocGenerateBtn({ btn, grid, ext, filename, mode }: Props) {
const isFlyout = mode === "flyout";
const [sm, md] = grid;

if (isFlyout) {
return (
<Col sm={sm} md={md} key={`with-ai-${ext}`}>
<Flex align="flex-start" vertical={false} gap={"5px"}>
<Flex flex={"1 1 auto"}>{btn}</Flex>
<Flex flex={"0 0 auto"}>
<AIGenerateDocumentButton
mode="flyout"
ext={ext}
filename={filename}
/>
</Flex>
</Flex>
</Col>
);
} else {
return (
//<Space direction="vertical">
<Flex
align="flex-start"
vertical={true}
gap={"5px"}
style={{ width: "100%" }}
>
<Flex flex={"1 1 auto"}>{btn}</Flex>
<Flex flex={"0 0 auto"}>
<AIGenerateDocumentButton mode="full" ext={ext} filename={filename} />
</Flex>
</Flex>
);
}
}
Loading
Loading