mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
Merge 8bb99166de into af4a62b69a
This commit is contained in:
commit
d934704205
20 changed files with 69 additions and 1 deletions
|
|
@ -370,6 +370,7 @@ export const ChatComposer = forwardRef<ChatComposerHandle, Props>(
|
|||
const [toolsOpen, setToolsOpen] = useState(false);
|
||||
const [toolsTab, setToolsTab] = useState<ToolsTab>('plugins');
|
||||
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const folderInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
|
||||
const composingRef = useRef(false);
|
||||
const toolsMenuRef = useRef<HTMLDivElement | null>(null);
|
||||
|
|
@ -975,7 +976,10 @@ export const ChatComposer = forwardRef<ChatComposerHandle, Props>(
|
|||
async function uploadFiles(files: File[]) {
|
||||
if (files.length === 0) return;
|
||||
const id = await ensureProject();
|
||||
if (!id) return;
|
||||
if (!id) {
|
||||
setUploadError(t('chat.uploadNoProjectError'));
|
||||
return;
|
||||
}
|
||||
setUploading(true);
|
||||
setUploadError(null);
|
||||
// Cohort math is identical to the Design Files Upload button; see
|
||||
|
|
@ -1961,6 +1965,19 @@ export const ChatComposer = forwardRef<ChatComposerHandle, Props>(
|
|||
e.target.value = '';
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
ref={folderInputRef}
|
||||
data-testid="chat-folder-input"
|
||||
type="file"
|
||||
/* @ts-expect-error webkitdirectory is not in the standard but widely supported */
|
||||
webkitdirectory=""
|
||||
style={{ display: 'none' }}
|
||||
onChange={(e) => {
|
||||
const files = Array.from(e.target.files ?? []);
|
||||
void uploadFiles(files);
|
||||
e.target.value = '';
|
||||
}}
|
||||
/>
|
||||
<div className="composer-tools-wrap">
|
||||
<button
|
||||
ref={toolsTriggerRef}
|
||||
|
|
@ -2136,6 +2153,10 @@ export const ChatComposer = forwardRef<ChatComposerHandle, Props>(
|
|||
setToolsOpen(false);
|
||||
await handleLinkFolder();
|
||||
}}
|
||||
onUploadFolder={() => {
|
||||
setToolsOpen(false);
|
||||
folderInputRef.current?.click();
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
@ -2963,9 +2984,11 @@ function pluginSourceLabel(plugin: InstalledPluginRecord, t: TranslateFn): strin
|
|||
function ToolsImportPanel({
|
||||
t,
|
||||
onLinkFolder,
|
||||
onUploadFolder,
|
||||
}: {
|
||||
t: TranslateFn;
|
||||
onLinkFolder: () => Promise<void> | void;
|
||||
onUploadFolder: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="composer-tools-list">
|
||||
|
|
@ -2978,6 +3001,13 @@ function ToolsImportPanel({
|
|||
enabled
|
||||
onClick={() => void onLinkFolder()}
|
||||
/>
|
||||
<ImportItem
|
||||
icon="upload"
|
||||
label={t('chat.uploadFolder')}
|
||||
t={t}
|
||||
enabled
|
||||
onClick={onUploadFolder}
|
||||
/>
|
||||
<ImportItem icon="sparkles" label={t('chat.importSkills')} t={t} />
|
||||
<ImportItem icon="file" label={t('chat.importProject')} t={t} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -876,6 +876,8 @@ export const ar: Dict = {
|
|||
'chat.importFig': 'رفع ملف .fig',
|
||||
'chat.importGitHub': 'ربط GitHub',
|
||||
'chat.importWeb': 'جلب عنصر ويب',
|
||||
'chat.uploadFolder': 'تحميل مجلد',
|
||||
'chat.uploadNoProjectError': 'ابدأ محادثة أولاً قبل تحميل الملفات',
|
||||
'chat.importFolder': 'ربط مجلد كود',
|
||||
'chat.importSkills': 'المهارات وأنظمة التصميم',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -764,6 +764,8 @@ export const de: Dict = {
|
|||
'chat.importFig': '.fig-Datei hochladen',
|
||||
'chat.importGitHub': 'GitHub verbinden',
|
||||
'chat.importWeb': 'Webelement erfassen',
|
||||
'chat.uploadFolder': 'Ordner hochladen',
|
||||
'chat.uploadNoProjectError': 'Starten Sie zuerst eine Unterhaltung, bevor Sie Dateien hochladen',
|
||||
'chat.importFolder': 'Code-Ordner verknüpfen',
|
||||
'chat.importSkills': 'Skills und Designsysteme',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -1481,6 +1481,8 @@ export const en: Dict = {
|
|||
'chat.importGitHub': 'Connect GitHub',
|
||||
'chat.importWeb': 'Grab web element',
|
||||
'chat.importFolder': 'Link code folder',
|
||||
'chat.uploadFolder': 'Upload folder',
|
||||
'chat.uploadNoProjectError': 'Start a conversation first before uploading files',
|
||||
'chat.importSkills': 'Skills and design systems',
|
||||
'chat.importProject': 'Reference another project',
|
||||
'chat.mentionTabsAria': 'Mention surfaces',
|
||||
|
|
|
|||
|
|
@ -765,6 +765,8 @@ export const esES: Dict = {
|
|||
'chat.importFig': 'Subir archivo .fig',
|
||||
'chat.importGitHub': 'Conectar GitHub',
|
||||
'chat.importWeb': 'Capturar elemento web',
|
||||
'chat.uploadFolder': 'Subir carpeta',
|
||||
'chat.uploadNoProjectError': 'Inicia una conversación antes de subir archivos',
|
||||
'chat.importFolder': 'Vincular carpeta de código',
|
||||
'chat.importSkills': 'Skills y sistemas de diseño',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -898,6 +898,8 @@ export const fa: Dict = {
|
|||
'chat.importFig': 'آپلود فایل .fig',
|
||||
'chat.importGitHub': 'اتصال به GitHub',
|
||||
'chat.importWeb': 'گرفتن عنصر وب',
|
||||
'chat.uploadFolder': 'آپلود پوشه',
|
||||
'chat.uploadNoProjectError': 'ابتدا یک مکالمه شروع کنید قبل از آپلود فایلها',
|
||||
'chat.importFolder': 'لینک کردن پوشه کد',
|
||||
'chat.importSkills': 'مهارتها و سیستمهای طراحی',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -1412,6 +1412,8 @@ export const fr: Dict = {
|
|||
'chat.importFig': 'Téléverser un fichier .fig',
|
||||
'chat.importGitHub': 'Connecter GitHub',
|
||||
'chat.importWeb': 'Capturer un élément web',
|
||||
'chat.uploadFolder': 'Télécharger un dossier',
|
||||
'chat.uploadNoProjectError': 'Démarrez une conversation avant de télécharger des fichiers',
|
||||
'chat.importFolder': 'Lier un dossier de code',
|
||||
'chat.importSkills': 'Compétences et systèmes de design',
|
||||
'chat.importProject': 'Référencer un autre projet',
|
||||
|
|
|
|||
|
|
@ -876,6 +876,8 @@ export const hu: Dict = {
|
|||
'chat.importFig': '.fig fájl feltöltése',
|
||||
'chat.importGitHub': 'GitHub csatlakoztatása',
|
||||
'chat.importWeb': 'Webelem mentése',
|
||||
'chat.uploadFolder': 'Mappa feltöltése',
|
||||
'chat.uploadNoProjectError': 'Indítson beszélgetést a fájlok feltöltése előtt',
|
||||
'chat.importFolder': 'Kódmappa hozzákapcsolása',
|
||||
'chat.importSkills': 'Skillek és designrendszerek',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -989,6 +989,8 @@ export const id: Dict = {
|
|||
'chat.importFig': 'File desain',
|
||||
'chat.importGitHub': 'GitHub',
|
||||
'chat.importWeb': 'Web',
|
||||
'chat.uploadFolder': 'Unggah folder',
|
||||
'chat.uploadNoProjectError': 'Mulai percakapan terlebih dahulu sebelum mengunggah file',
|
||||
'chat.importFolder': 'Tautkan folder kode',
|
||||
'chat.importSkills': 'Skills',
|
||||
'chat.importProject': 'Proyek',
|
||||
|
|
|
|||
|
|
@ -763,6 +763,8 @@ export const ja: Dict = {
|
|||
'chat.importFig': '.fig ファイルをアップロード',
|
||||
'chat.importGitHub': 'GitHub に接続',
|
||||
'chat.importWeb': 'Web 要素を取得',
|
||||
'chat.uploadFolder': 'フォルダをアップロード',
|
||||
'chat.uploadNoProjectError': 'ファイルをアップロードする前に会話を開始してください',
|
||||
'chat.importFolder': 'コードフォルダーをリンク',
|
||||
'chat.importSkills': 'スキルとデザインシステム',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -876,6 +876,8 @@ export const ko: Dict = {
|
|||
'chat.importFig': '.fig 파일 업로드',
|
||||
'chat.importGitHub': 'GitHub 연결',
|
||||
'chat.importWeb': '웹 요소 가져오기',
|
||||
'chat.uploadFolder': '폴더 업로드',
|
||||
'chat.uploadNoProjectError': '파일을 업로드하기 전에 먼저 대화를 시작하세요',
|
||||
'chat.importFolder': '코드 폴더 연결',
|
||||
'chat.importSkills': '스킬 및 디자인 시스템',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -876,6 +876,8 @@ export const pl: Dict = {
|
|||
'chat.importFig': 'Prześlij plik .fig',
|
||||
'chat.importGitHub': 'Połącz z GitHub',
|
||||
'chat.importWeb': 'Pobierz element webowy',
|
||||
'chat.uploadFolder': 'Prześlij folder',
|
||||
'chat.uploadNoProjectError': 'Rozpocznij rozmowę przed przesłaniem plików',
|
||||
'chat.importFolder': 'Połącz folder z kodem',
|
||||
'chat.importSkills': 'Umiejętności i systemy projektowania',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -897,6 +897,8 @@ export const ptBR: Dict = {
|
|||
'chat.importFig': 'Enviar arquivo .fig',
|
||||
'chat.importGitHub': 'Conectar GitHub',
|
||||
'chat.importWeb': 'Capturar elemento web',
|
||||
'chat.uploadFolder': 'Enviar pasta',
|
||||
'chat.uploadNoProjectError': 'Inicie uma conversa antes de enviar arquivos',
|
||||
'chat.importFolder': 'Vincular pasta de código',
|
||||
'chat.importSkills': 'Skills e sistemas de design',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -897,6 +897,8 @@ export const ru: Dict = {
|
|||
'chat.importFig': 'Загрузить .fig файл',
|
||||
'chat.importGitHub': 'Подключить GitHub',
|
||||
'chat.importWeb': 'Захватить веб-элемент',
|
||||
'chat.uploadFolder': 'Загрузить папку',
|
||||
'chat.uploadNoProjectError': 'Начните разговор перед загрузкой файлов',
|
||||
'chat.importFolder': 'Ссылка на папку с кодом',
|
||||
'chat.importSkills': 'Навыки и дизайн-системы',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -831,6 +831,8 @@ export const th: Dict = {
|
|||
'chat.importFig': 'อัปโหลดไฟล์ Figma',
|
||||
'chat.importGitHub': 'ต่อ GitHub',
|
||||
'chat.importWeb': 'ดึงหน้าเว็บ',
|
||||
'chat.uploadFolder': 'อัปโหลดโฟลเดอร์',
|
||||
'chat.uploadNoProjectError': 'เริ่มการสนทนาก่อนอัปโหลดไฟล์',
|
||||
'chat.importFolder': 'ลิ้งก์โค้ดโฟลเดอร์',
|
||||
'chat.importSkills': 'ทักษะและระบบการออกแบบ',
|
||||
'chat.importProject': 'อ้างอิงโปรเจกต์อื่น',
|
||||
|
|
|
|||
|
|
@ -865,6 +865,8 @@ export const tr: Dict = {
|
|||
'chat.importFig': 'Bir .fig dosyası yükleyin',
|
||||
'chat.importGitHub': 'GitHub bağla',
|
||||
'chat.importWeb': 'Bir web elementi',
|
||||
'chat.uploadFolder': 'Klasör yükle',
|
||||
'chat.uploadNoProjectError': 'Dosya yüklemeden önce bir sohbet başlatın',
|
||||
'chat.importFolder': 'Kod klasörünü bağlantıla',
|
||||
'chat.importSkills': 'Yetenekler ve tasarım sistemleri',
|
||||
'chat.importProject': 'Reference another project',
|
||||
|
|
|
|||
|
|
@ -898,6 +898,8 @@ export const uk: Dict = {
|
|||
'chat.importFig': 'Завантажити файл .fig',
|
||||
'chat.importGitHub': 'Підключити GitHub',
|
||||
'chat.importWeb': 'Захопити веб-елемент',
|
||||
'chat.uploadFolder': 'Завантажити папку',
|
||||
'chat.uploadNoProjectError': 'Почніть розмову перед завантаженням файлів',
|
||||
'chat.importFolder': 'Пов\'язати папку коду',
|
||||
'chat.importSkills': 'Навички та системи дизайну',
|
||||
'chat.importProject': 'Посилання на інший проект',
|
||||
|
|
|
|||
|
|
@ -1471,6 +1471,8 @@ export const zhCN: Dict = {
|
|||
'chat.importFig': '上传 .fig 文件',
|
||||
'chat.importGitHub': '连接 GitHub',
|
||||
'chat.importWeb': '抓取网页元素',
|
||||
'chat.uploadFolder': '上传文件夹',
|
||||
'chat.uploadNoProjectError': '上传文件前请先开始对话',
|
||||
'chat.importFolder': '关联代码目录',
|
||||
'chat.importSkills': '技能与设计体系',
|
||||
'chat.importProject': '引用其它项目',
|
||||
|
|
|
|||
|
|
@ -1071,6 +1071,8 @@ export const zhTW: Dict = {
|
|||
'chat.importFig': '上傳 .fig 檔案',
|
||||
'chat.importGitHub': '連接 GitHub',
|
||||
'chat.importWeb': '擷取網頁元素',
|
||||
'chat.uploadFolder': '上傳資料夾',
|
||||
'chat.uploadNoProjectError': '上傳檔案前請先開始對話',
|
||||
'chat.importFolder': '關聯程式碼目錄',
|
||||
'chat.importSkills': '技能與設計系統',
|
||||
'chat.importProject': '引用其它專案',
|
||||
|
|
|
|||
|
|
@ -1806,6 +1806,8 @@ export interface Dict {
|
|||
'chat.importGitHub': string;
|
||||
'chat.importWeb': string;
|
||||
'chat.importFolder': string;
|
||||
'chat.uploadFolder': string;
|
||||
'chat.uploadNoProjectError': string;
|
||||
'chat.importSkills': string;
|
||||
'chat.importProject': string;
|
||||
'chat.mentionTabsAria': string;
|
||||
|
|
|
|||
Loading…
Reference in a new issue