From 2c0b79cbaf7faa516c87d1c367f79123d1f8b277 Mon Sep 17 00:00:00 2001 From: americano98 Date: Fri, 27 Dec 2024 14:34:07 +0300 Subject: [PATCH] feat(styles): update summary page --- packages/ui/locales/en/views.json | 6 ++- packages/ui/locales/es/views.json | 6 ++- packages/ui/locales/fr/views.json | 6 ++- packages/ui/src/components/copy-button.tsx | 20 ++++++++-- packages/ui/src/components/dialog.tsx | 2 +- .../token-dialog/clone-credential-dialog.tsx | 22 +++++++---- .../components/clone-repo-dialog.tsx | 37 ++++++++++-------- .../views/repo/repo-summary/repo-summary.tsx | 38 ++++++++++++++----- 8 files changed, 93 insertions(+), 44 deletions(-) diff --git a/packages/ui/locales/en/views.json b/packages/ui/locales/en/views.json index 41587e39fe..d5447573a0 100644 --- a/packages/ui/locales/en/views.json +++ b/packages/ui/locales/en/views.json @@ -116,14 +116,16 @@ "general": "General", "codeAutomation": "Code and automation", "webhooks": "Webhooks", - "clone": "Clone", "cloneRepo": "Clone repository", "cloneHttps": "HTTPS", "cloneSsh": "SSH", + "gitCloneUrl": "Git clone URL", "generateCredential": "Please generate a clone credential if its your first time.", - "addFile": "Add file", "readme": "README.md", + "editReadme": "Edit README.md", "openPullReq": "Open pull requests", + "clone": "Clone", + "addFile": "Add file", "enableWebhookToggle": "Enable the webhook", "toggleDescription": "We will deliver event details when this hook is triggered", "desciptionPlaceholder": "Enter a description of this rule...", diff --git a/packages/ui/locales/es/views.json b/packages/ui/locales/es/views.json index f0870d54a3..c451546df7 100644 --- a/packages/ui/locales/es/views.json +++ b/packages/ui/locales/es/views.json @@ -116,14 +116,16 @@ "general": "General", "codeAutomation": "Code and automation", "webhooks": "Webhooks", - "clone": "Clone", "cloneRepo": "Clone repository", "cloneHttps": "HTTPS", "cloneSsh": "SSH", + "gitCloneUrl": "Git clone URL", "generateCredential": "Please generate a clone credential if its your first time.", - "addFile": "Add file", "readme": "README.md", + "editReadme": "Edit README.md", "openPullReq": "Open pull requests", + "clone": "Clone", + "addFile": "Add file", "enableWebhookToggle": "Enable the webhook", "toggleDescription": "We will deliver event details when this hook is triggered", "desciptionPlaceholder": "Enter a description of this rule...", diff --git a/packages/ui/locales/fr/views.json b/packages/ui/locales/fr/views.json index d10f1ec8a9..60cb1e9405 100644 --- a/packages/ui/locales/fr/views.json +++ b/packages/ui/locales/fr/views.json @@ -116,14 +116,16 @@ "general": "Général", "codeAutomation": "Automatisation du code", "webhooks": "Webhooks", - "clone": "Cloner", "cloneRepo": "Cloner le dépôt", "cloneHttps": "HTTPS", "cloneSsh": "SSH", + "gitCloneUrl": "Git clone URL", "generateCredential": "Veuillez générer un identifiant de clonage si c'est la première fois.", - "addFile": "Ajouter un fichier", "readme": "README.md", + "editReadme": "Edit README.md", "openPullReq": "Requêtes de tirage ouvertes", + "clone": "Cloner", + "addFile": "Ajouter un fichier", "enableWebhookToggle": "Activer le webhook", "toggleDescription": "Nous enverrons les détails lorsque ce webhook sera déclenché", "desciptionPlaceholder": "Entrez une description de cette règle...", diff --git a/packages/ui/src/components/copy-button.tsx b/packages/ui/src/components/copy-button.tsx index 5e3f12e974..ae932009c5 100644 --- a/packages/ui/src/components/copy-button.tsx +++ b/packages/ui/src/components/copy-button.tsx @@ -1,4 +1,4 @@ -import { FC, useEffect, useState } from 'react' +import { FC, MouseEvent, useEffect, useState } from 'react' import { Button, ButtonProps, Icon } from '@/components' import copy from 'clipboard-copy' @@ -8,11 +8,23 @@ export interface CopyButtonProps { className?: string buttonVariant?: ButtonProps['variant'] iconSize?: number + onClick?: (e: MouseEvent) => void } -export const CopyButton: FC = ({ name, className, buttonVariant = 'custom', iconSize = 16 }) => { +export const CopyButton: FC = ({ + name, + className, + buttonVariant = 'custom', + iconSize = 16, + onClick +}) => { const [copied, setCopied] = useState(false) + const handleClick = (e: MouseEvent) => { + onClick?.(e) + setCopied(true) + } + useEffect(() => { let timeoutId: number @@ -29,8 +41,8 @@ export const CopyButton: FC = ({ name, className, buttonVariant const changeIcon = copied ? 'tick' : 'clone' return ( - ) } diff --git a/packages/ui/src/components/dialog.tsx b/packages/ui/src/components/dialog.tsx index 25792bbdd9..b3e61819a4 100644 --- a/packages/ui/src/components/dialog.tsx +++ b/packages/ui/src/components/dialog.tsx @@ -64,7 +64,7 @@ const DialogContent = React.forwardRef {footer} - + - -
- {t('views:repos.cloneRepo', 'Clone repository')} + +
+ {t('views:repos.cloneRepo', 'Clone repository')}
setCurrentTab(val as CloneRepoTabs)} > - + { @@ -62,7 +62,7 @@ export const CloneRepoDialog: React.FC = ({ setCurrentTab(CloneRepoTabs.HTTPS) }} > - + {t('views:repos.cloneHttps', 'HTTPS')} @@ -74,7 +74,7 @@ export const CloneRepoDialog: React.FC = ({ }} > e.stopPropagation()} > @@ -83,20 +83,25 @@ export const CloneRepoDialog: React.FC = ({ -
+
+
+ + {t('views:repos.gitCloneUrl', 'Git clone URL')} + +
{currentTab === 'https' ? ( <> } />
- + {t('views:repos.generateCredential', 'Please generate a clone credential if its your first time.')}
@@ -108,10 +113,10 @@ export const CloneRepoDialog: React.FC = ({ ) : ( } diff --git a/packages/ui/src/views/repo/repo-summary/repo-summary.tsx b/packages/ui/src/views/repo/repo-summary/repo-summary.tsx index e37f4d5393..92a2fd5ebb 100644 --- a/packages/ui/src/views/repo/repo-summary/repo-summary.tsx +++ b/packages/ui/src/views/repo/repo-summary/repo-summary.tsx @@ -1,10 +1,12 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { Link, useNavigate } from 'react-router-dom' +import { Link } from 'react-router-dom' import { Button, ButtonGroup, + FileAdditionsTrigger, + Icon, ListActions, MarkdownViewer, NoData, @@ -96,7 +98,6 @@ export function RepoSummaryView({ setSearchQuery, handleCreateToken }: RepoSummaryViewProps) { - const navigate = useNavigate() const { t } = useTranslationStore() const { repoId, spaceId, selectedBranchTag } = useRepoBranchesStore() @@ -190,11 +191,12 @@ export function RepoSummaryView({ - + - + {t('views:repos.readme', 'README.md')}} /> - {/* TODO: add component and file editing logic */} - + + + + {t('views:repos.editReadme', 'Edit README.md')} + + + } + />