adjust style
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
PASTE_COMMAND,
|
||||
} from 'lexical';
|
||||
import { Upload } from 'lucide-react';
|
||||
import { useEffect, useMemo, useRef } from 'react';
|
||||
import React, { useEffect, useMemo, useRef } from 'react';
|
||||
|
||||
import type { HomeAttachmentDraft, RichText } from '../../useHomeDraftStore';
|
||||
import AttachmentContext from './attachmentContext';
|
||||
@@ -38,6 +38,7 @@ type RichInputAreaProps = {
|
||||
onChange: (value: RichText[]) => void;
|
||||
onAttachmentsAdd: (attachments: HomeAttachmentDraft[]) => void;
|
||||
onAttachmentRemove: (attachmentId: string) => void;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
const INSERT_ATTACHMENTS_COMMAND: LexicalCommand<HomeAttachmentDraft[]> =
|
||||
createCommand('INSERT_HOME_ATTACHMENTS_COMMAND');
|
||||
@@ -207,7 +208,7 @@ function collectRichText(node: LexicalNode, parts: RichText[]) {
|
||||
}
|
||||
}
|
||||
|
||||
function UploadButton({
|
||||
export function UploadButton({
|
||||
onAttachmentsAdd,
|
||||
}: Pick<RichInputAreaProps, 'onAttachmentsAdd'>) {
|
||||
const [editor] = useLexicalComposerContext();
|
||||
@@ -290,9 +291,7 @@ export default function RichInputArea(props: RichInputAreaProps) {
|
||||
}
|
||||
ErrorBoundary={LexicalErrorBoundary}
|
||||
/>
|
||||
<div className="flex items-center">
|
||||
<UploadButton onAttachmentsAdd={props.onAttachmentsAdd} />
|
||||
</div>
|
||||
{props.children}
|
||||
</div>
|
||||
<EditorPlugins
|
||||
onChange={props.onChange}
|
||||
|
||||
@@ -9,15 +9,15 @@ import type {
|
||||
} from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import BRAND_ICON from '../../../../../packages/shared/src/icons/taonier-product-ip.png'
|
||||
import RichInputArea, { UploadButton } from './components/RichInputArea';
|
||||
import { richTextToPrompt } from './components/RichInputArea/richTextToPrompt';
|
||||
import {
|
||||
type HomeAgentMode,
|
||||
type HomeDraft,
|
||||
useLauncherHomeDraftStore,
|
||||
} from './useHomeDraftStore';
|
||||
import RichInputArea from './components/RichInputArea';
|
||||
import { richTextToPrompt } from './components/RichInputArea/richTextToPrompt';
|
||||
import { useHomeShowcase } from './useHomeShowcase';
|
||||
import BRAND_ICON from '../../../../../packages/shared/src/icons/taonier-product-ip.png'
|
||||
|
||||
export type {
|
||||
HomeAgentMode,
|
||||
@@ -39,17 +39,6 @@ export type HomeProjectRow = {
|
||||
status: string;
|
||||
canOpen: boolean;
|
||||
};
|
||||
|
||||
export type HomeShowcaseResource = {
|
||||
resourceId: string;
|
||||
showcaseId?: string | null;
|
||||
label?: string | null;
|
||||
imageSrc: string;
|
||||
prompt?: string | null;
|
||||
authorDisplayName?: string | null;
|
||||
authorPublicUserCode?: string | null;
|
||||
};
|
||||
|
||||
type HomeViewProps = {
|
||||
hasPromo: boolean;
|
||||
status: string;
|
||||
@@ -97,8 +86,6 @@ export default function HomeView({
|
||||
return null;
|
||||
}
|
||||
|
||||
const ActiveHomeModeIcon = activeHomeMode.icon;
|
||||
|
||||
async function handleHomeSubmit(event: FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
const prompt = richTextToPrompt(homeRichText, homeAttachments);
|
||||
@@ -171,8 +158,9 @@ export default function HomeView({
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<span>{status}</span>
|
||||
<form
|
||||
className="grid min-h-20 w-[min(488px,calc(100vw-110px))] grid-rows-[minmax(42px,auto)_auto] rounded-[18px] border border-(--platform-surface-border) bg-(--platform-input-fill) px-3 pb-2 pt-3.25 shadow-(--platform-panel-shadow) focus-within:bg-(--platform-input-fill-focus) focus-within:ring-4 focus-within:ring-(--platform-input-focus-ring) max-[760px]:w-[min(100%,calc(100vw-76px))]"
|
||||
className="grid min-h-20 w-[min(1054px,calc(100vw-122px))] grid-rows-[minmax(42px,auto)_auto] rounded-[18px] border border-(--platform-surface-border) bg-(--platform-input-fill) px-3 pb-2 pt-3.25 shadow-(--platform-panel-shadow) focus-within:bg-(--platform-input-fill-focus) focus-within:ring-4 focus-within:ring-(--platform-input-focus-ring) max-[760px]:w-[min(100%,calc(100vw-76px))]"
|
||||
onSubmit={handleHomeSubmit}
|
||||
>
|
||||
<RichInputArea
|
||||
@@ -182,19 +170,19 @@ export default function HomeView({
|
||||
onChange={setHomeRichText}
|
||||
onAttachmentsAdd={addHomeAttachments}
|
||||
onAttachmentRemove={removeHomeAttachment}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-[1fr_auto] items-center gap-2.5 text-[12px] text-(--platform-text-soft)">
|
||||
<span>{status}</span>
|
||||
<button
|
||||
className="grid size-6 cursor-pointer place-items-center rounded-full border-0 bg-(image:--platform-button-primary-fill) p-0 text-(--platform-button-primary-text) shadow-(--platform-profile-action-shadow) disabled:cursor-not-allowed disabled:opacity-55"
|
||||
type="submit"
|
||||
aria-label="开启创作"
|
||||
disabled={homeCreationBusy}
|
||||
>
|
||||
<Plus size={16} aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
>
|
||||
<div className="grid grid-cols-[1fr_auto] items-center gap-2.5 text-[12px] text-(--platform-text-soft)">
|
||||
<UploadButton onAttachmentsAdd={addHomeAttachments} />
|
||||
<button
|
||||
className="grid size-6 cursor-pointer place-items-center rounded-full border-0 bg-(image:--platform-button-primary-fill) p-0 text-(--platform-button-primary-text) shadow-(--platform-profile-action-shadow) disabled:cursor-not-allowed disabled:opacity-55"
|
||||
type="submit"
|
||||
aria-label="开启创作"
|
||||
disabled={homeCreationBusy}
|
||||
>
|
||||
<Plus size={16} aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</RichInputArea>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user