Skip to content

Commit 6d96390

Browse files
authored
fix: edit app name and desc (#767)
1 parent 836acdf commit 6d96390

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.changeset/silver-dryers-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@mochi-ui/theme": minor
3+
---
4+
5+
Fix ContentEditable style

apps/mochi-web/components/app/detail/AppDetailStatistics.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { Control, Controller } from 'react-hook-form'
2222
import { AppDetailFormValues } from '~types/app'
2323
import { ChangeEvent, useState, useRef } from 'react'
2424
import { API, GET_PATHS } from '~constants/api'
25+
import clsx from 'clsx'
2526
import { StatisticsBox } from '../StatisticsBox'
2627

2728
interface Props {
@@ -119,7 +120,11 @@ export const AppDetailStatistics = ({
119120
<FormLabel>Display name</FormLabel>
120121
<ContentEditable
121122
{...field}
122-
className="text-sm font-medium"
123+
className={clsx('text-sm font-medium', {
124+
'border border-divider rounded px-3.5 py-2.5':
125+
editing === field.name,
126+
})}
127+
placeholder="Provide a name for your app..."
123128
disabled={editing !== field.name}
124129
onBlur={() => setEditing('')}
125130
ref={(ref) => {
@@ -158,7 +163,10 @@ export const AppDetailStatistics = ({
158163
<FormLabel>Description</FormLabel>
159164
<ContentEditable
160165
{...field}
161-
className="text-sm font-medium"
166+
className={clsx('text-sm font-medium', {
167+
'border border-divider rounded px-3.5 py-2.5':
168+
editing === field.name,
169+
})}
162170
placeholder="Provide a description for your app..."
163171
disabled={editing !== field.name}
164172
onBlur={() => setEditing('')}

apps/mochi-web/pages/applications/[id].tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { AppDetailUrl } from '~cpn/app/detail/AppDetailUrl'
1010
import {
1111
DtoUpdateApplicationInfoRequest,
1212
ViewApplication,
13-
ViewApplicationResponse,
1413
ViewFullApplicationResponse,
1514
} from '~types/mochi-pay-schema'
1615
import { API, GET_PATHS } from '~constants/api'
@@ -157,8 +156,8 @@ const App: NextPageWithLayout = () => {
157156
body,
158157
GET_PATHS.UPDATE_APPLICATION_DETAIL(profileId, appId),
159158
)
160-
.json((r: ViewApplicationResponse) => {
161-
resetApp(r.data)
159+
.json(() => {
160+
refresh()
162161
})
163162
.catch((e) => {
164163
const err = JSON.parse(e.message)

packages/theme/src/components/content-editable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import clsx from 'clsx'
22

33
const contentEditableClsx = ({ className = '' }: { className?: string } = {}) =>
44
clsx(
5-
'outline-none break-all empty:before:content-[attr(placeholder)] before:text-text-secondary before:font-normal',
5+
'outline-none break-all empty:before:content-[attr(placeholder)] before:text-text-disabled before:font-normal',
66
className,
77
)
88

0 commit comments

Comments
 (0)