Skip to content

Commit

Permalink
Added better edit functionality caprover/caprover#2170
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsaturn committed Oct 27, 2024
1 parent 3ee5d08 commit ffb2b69
Showing 1 changed file with 46 additions and 24 deletions.
70 changes: 46 additions & 24 deletions src/containers/apps/appDetails/AppDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import {
CaretRightOutlined,
CloseOutlined,
DeleteOutlined,
FolderOpenOutlined,
MoreOutlined,
SaveOutlined,
} from '@ant-design/icons'
import type { MenuProps } from 'antd'
import {
Affix,
Button,
Card,
Col,
Dropdown,
Input,
Modal,
Row,
Space,
Tabs,
Tag,
Tooltip,
Typography,
} from 'antd'
import classnames from 'classnames'
Expand Down Expand Up @@ -191,6 +193,36 @@ class AppDetails extends ApiComponent<

const appName = app.appName || ''

const onEditClicked = () => {
self.setState({
editAppDataForModal: {
parentProjectId: app.projectId || '',
appName: appName,
description: app.description || '',
tags: (app.tags || []).map((it) => it.tagName),
},
})
}

const items: MenuProps['items'] = [
{
key: '1',
label: (
<ClickableLink onLinkClicked={() => onEditClicked()}>
{localize('apps.edit', 'Edit')}
</ClickableLink>
),
},
{
key: '2',
label: (
<ClickableLink onLinkClicked={() => self.goBackToApps()}>
{localize('apps.close_tooltip', 'Close')}
</ClickableLink>
),
},
]

return (
<div style={{ marginTop: 20, marginBottom: 10, width: '100%' }}>
<div
Expand All @@ -204,19 +236,18 @@ class AppDetails extends ApiComponent<
>
<Row justify={'end'}>
<Col>
{' '}
<ClickableLink
onLinkClicked={() => self.goBackToApps()}
>
<Tooltip
title={localize(
'apps.close_tooltip',
'Close'
)}
<Dropdown trigger={['click']} menu={{ items }}>
<a
href="#/"
onClick={(e) => e.preventDefault()}
>
<CloseOutlined />
</Tooltip>
</ClickableLink>
<Space>
<MoreOutlined
style={{ fontSize: `1.6em` }}
/>
</Space>
</a>
</Dropdown>
</Col>
</Row>
</div>
Expand All @@ -230,16 +261,7 @@ class AppDetails extends ApiComponent<
>
<EditableSpan
onEditClick={() => {
self.setState({
editAppDataForModal: {
parentProjectId: app.projectId || '',
appName: appName,
description: app.description || '',
tags: (app.tags || []).map(
(it) => it.tagName
),
},
})
onEditClicked()
}}
>
{appName}
Expand Down

0 comments on commit ffb2b69

Please sign in to comment.