Skip to content

Commit 338289a

Browse files
committed
Always show the appName input
1 parent 0627541 commit 338289a

File tree

3 files changed

+17
-32
lines changed

3 files changed

+17
-32
lines changed

src/components/common/Select.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import styled from '@emotion/styled'
3-
import { Select as AntdSelect } from 'antd'
3+
import { Select as AntdSelect, Typography } from 'antd'
44

55
const { Option } = AntdSelect
66

@@ -13,7 +13,7 @@ const SelectBox = styled(AntdSelect)`
1313

1414
const Select = ({ title, options, ...props }) => (
1515
<SelectBoxContainer>
16-
<h4>{title}</h4>
16+
<Typography.Title level={5}>{title}</Typography.Title>
1717

1818
<SelectBox size="large" {...props}>
1919
{options.map((option) => (

src/components/common/Settings.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
import React, { useState } from 'react'
2-
import { Popover, Button, Checkbox, Input, Radio } from 'antd'
2+
import { Popover, Button, Checkbox, Radio } from 'antd'
33
import { SHOW_LATEST_RCS } from '../../utils'
44
import styled from '@emotion/styled'
55
import { WindowsFilled } from '@ant-design/icons'
6-
import {
7-
DEFAULT_APP_NAME,
8-
PACKAGE_NAMES,
9-
LANGUAGE_NAMES,
10-
} from '../../constants'
11-
12-
const InputContainer = styled.div({
13-
marginTop: '16px',
14-
})
6+
import { PACKAGE_NAMES, LANGUAGE_NAMES } from '../../constants'
157

168
const SettingsButton = styled(Button)`
179
color: initial;
@@ -39,21 +31,14 @@ const Settings = ({
3931
packageName,
4032
language,
4133
onChangePackageNameAndLanguage,
42-
appName,
43-
onChangeAppName,
4434
}) => {
4535
const [popoverVisibility, setVisibility] = useState(false)
46-
const [newAppName, setNewAppName] = useState(appName)
4736
const [newPackageName, setNewPackageName] = useState(packageName)
4837
const [newLanguage, setNewLanguage] = useState(language)
4938

5039
const handleClickChange = (visibility) => {
5140
setVisibility(visibility)
5241

53-
if (newAppName !== appName) {
54-
onChangeAppName(newAppName)
55-
}
56-
5742
const processedNewLanguage =
5843
newLanguage !== language && newPackageName === PACKAGE_NAMES.RNW
5944
? newLanguage
@@ -84,14 +69,6 @@ const Settings = ({
8469
<Checkbox value={SHOW_LATEST_RCS}>{SHOW_LATEST_RCS}</Checkbox>
8570
</div>
8671
</Checkbox.Group>
87-
<InputContainer>
88-
<h4>What's your app name?</h4>
89-
<Input
90-
value={newAppName}
91-
onChange={({ target }) => setNewAppName(target.value)}
92-
placeholder={DEFAULT_APP_NAME}
93-
/>
94-
</InputContainer>
9572
<PlatformsContainer>
9673
<h5>Upgrading another platform?</h5>
9774
<Radio.Group

src/components/pages/Home.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from 'react'
22
import styled from '@emotion/styled'
3-
import { Card } from 'antd'
3+
import { Card, Input, Typography } from 'antd'
44
import GitHubButton from 'react-github-btn'
55
import ReactGA from 'react-ga'
66
import VersionSelector from '../common/VersionSelector'
@@ -10,7 +10,7 @@ import logo from '../../assets/logo.svg'
1010
import { SHOW_LATEST_RCS } from '../../utils'
1111
import { useGetLanguageFromURL } from '../../hooks/get-language-from-url'
1212
import { useGetPackageNameFromURL } from '../../hooks/get-package-name-from-url'
13-
import { PACKAGE_NAMES } from '../../constants'
13+
import { DEFAULT_APP_NAME, PACKAGE_NAMES } from '../../constants'
1414
import { TroubleshootingGuidesButton } from '../common/TroubleshootingGuidesButton'
1515
import { updateURL } from '../../utils/update-url'
1616
import { deviceSizes } from '../../utils/device-sizes'
@@ -91,6 +91,7 @@ const Home = () => {
9191
[`${SHOW_LATEST_RCS}`]: false,
9292
})
9393
const [appName, setAppName] = useState('')
94+
const fixedAppName = appName || DEFAULT_APP_NAME
9495

9596
const homepageUrl = process.env.PUBLIC_URL
9697

@@ -172,17 +173,24 @@ const Home = () => {
172173
)}
173174
<Settings
174175
handleSettingsChange={handleSettingsChange}
175-
appName={appName}
176176
packageName={packageName}
177177
onChangePackageNameAndLanguage={
178178
handlePackageNameAndLanguageChange
179179
}
180180
language={language}
181-
onChangeAppName={setAppName}
182181
/>
183182
</SettingsContainer>
184183
</HeaderContainer>
185184

185+
<Typography.Title level={5}>What's your app name?</Typography.Title>
186+
187+
<Input
188+
size="large"
189+
placeholder={DEFAULT_APP_NAME}
190+
value={appName}
191+
onChange={({ target }) => setAppName(target.value)}
192+
/>
193+
186194
<VersionSelector
187195
key={packageName}
188196
showDiff={handleShowDiff}
@@ -196,7 +204,7 @@ const Home = () => {
196204
shouldShowDiff={shouldShowDiff}
197205
fromVersion={fromVersion}
198206
toVersion={toVersion}
199-
appName={appName}
207+
appName={fixedAppName}
200208
packageName={packageName}
201209
language={language}
202210
/>

0 commit comments

Comments
 (0)