making admin dashboard more mobile friendly

This commit is contained in:
Roland Osborne 2022-08-24 22:36:41 -07:00
parent 2fb82d42b7
commit e852c419bc
6 changed files with 54 additions and 14 deletions

View File

@ -79,10 +79,11 @@ export function Dashboard({ token, config, logout }) {
footer={[ <Button type="primary" onClick={() => actions.setShowCreate(false)}>OK</Button> ]}
onCancel={() => actions.setShowCreate(false)}>
<CreateLayout>
<div>{createLink()}</div>
<div class="url">
<div class="link">{createLink()}</div>
<Button icon={<CopyOutlined />} size="small"
onClick={() => onClipboard(createLink())}
/>
onClick={() => onClipboard(createLink())} />
</div>
</CreateLayout>
</Modal>
</DashboardWrapper>

View File

@ -47,6 +47,8 @@ export const DashboardWrapper = styled.div`
.settings {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
}
.add {
@ -84,6 +86,19 @@ export const SettingsLayout = styled(Space)`
}
`;
export const CreateLayout = styled(Space)`
export const CreateLayout = styled.div`
.url {
display: flex;
flex-direction: row;
max-width: 100%;
.link {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
flex-grow: 1;
min-width: 0;
padding-right: 8px;
}
}
`

View File

@ -57,10 +57,11 @@ export function AccountItem({ token, item, remove }) {
footer={[ <Button type="primary" onClick={() => actions.setShowAccess(false)}>OK</Button> ]}
onCancel={() => actions.setShowAccess(false)}>
<AccessLayout>
<div>{accessLink()}</div>
<div class="url">
<div class="link">{accessLink()}</div>
<Button icon={<CopyOutlined />} size="small"
onClick={() => onClipboard(accessLink())}
/>
onClick={() => onClipboard(accessLink())}/>
</div>
</AccessLayout>
</Modal>
</AccountItemWrapper>

View File

@ -82,6 +82,19 @@ export const DeleteButton = styled(Button)`
color: red;
`
export const AccessLayout = styled(Space)`
export const AccessLayout = styled.div`
.url {
display: flex;
flex-direction: row;
width: 100%;
.link {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
flex-grow: 1;
min-width: 0;
padding-right: 8px;
}
}
`

View File

@ -26,6 +26,16 @@ export function Prompt({ login }) {
}
}
const placeholder = () => {
if (state.unclaimed === true) {
return 'Set Access Token';
}
if (state.unclaimed === false) {
return 'Access Token';
}
return '';
}
return (
<PromptWrapper>
<div class="app-title">
@ -39,7 +49,7 @@ export function Prompt({ login }) {
<Form name="basic" wrapperCol={{ span: 24, }}>
<Form.Item name="password">
<Input.Password placeholder="Admin Password" spellCheck="false" onChange={(e) => actions.setPassword(e.target.value)}
<Input.Password placeholder={placeholder()} spellCheck="false" onChange={(e) => actions.setPassword(e.target.value)}
autocomplete="current-password" onKeyDown={(e) => keyDown(e)} prefix={<LockOutlined />} size="large" />
</Form.Item>

View File

@ -24,7 +24,7 @@ export function usePrompt() {
const checkStatus = async () => {
try {
let status = await getNodeStatus();
updateState({ uncliamed: status });
updateState({ unclaimed: status });
}
catch(err) {
console.log("failed to check node status");