fix: change "add instance" to "log in" when not logged in (#1614)
This commit is contained in:
parent
08cd8f645f
commit
ee492c1765
|
@ -22,7 +22,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p style="text-align: right;">
|
<p style="text-align: right;">
|
||||||
<a class="button primary" rel="prefetch" href="/settings/instances/add">Add instance</a>
|
<a class="button primary" rel="prefetch" href="/settings/instances/add">Log in</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
`}
|
`}
|
||||||
|
|
|
@ -39,21 +39,22 @@
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import SettingsNavItem from './SettingsNavItem.html'
|
import SettingsNavItem from './SettingsNavItem.html'
|
||||||
|
import { store } from '../../_store/store'
|
||||||
const NAV_ITEMS = {
|
|
||||||
settings: 'Settings',
|
|
||||||
'settings/about': 'About Pinafore',
|
|
||||||
'settings/general': 'General',
|
|
||||||
'settings/instances': 'Instances',
|
|
||||||
'settings/instances/add': 'Add instance'
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
SettingsNavItem
|
SettingsNavItem
|
||||||
},
|
},
|
||||||
|
store: () => store,
|
||||||
computed: {
|
computed: {
|
||||||
navItems: ({ page }) => {
|
navItemLabels: ({ $isUserLoggedIn }) => ({
|
||||||
|
settings: 'Settings',
|
||||||
|
'settings/about': 'About Pinafore',
|
||||||
|
'settings/general': 'General',
|
||||||
|
'settings/instances': 'Instances',
|
||||||
|
'settings/instances/add': $isUserLoggedIn ? 'Add instance' : 'Log in'
|
||||||
|
}),
|
||||||
|
navItems: ({ page, navItemLabels }) => {
|
||||||
const res = []
|
const res = []
|
||||||
const breadcrumbs = page.split('/')
|
const breadcrumbs = page.split('/')
|
||||||
let path = ''
|
let path = ''
|
||||||
|
@ -61,7 +62,7 @@
|
||||||
const currentPage = breadcrumbs[i]
|
const currentPage = breadcrumbs[i]
|
||||||
path += currentPage
|
path += currentPage
|
||||||
res.push({
|
res.push({
|
||||||
label: NAV_ITEMS[path],
|
label: navItemLabels[path],
|
||||||
href: `/${path}`,
|
href: `/${path}`,
|
||||||
name: path
|
name: path
|
||||||
})
|
})
|
||||||
|
@ -71,4 +72,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<SettingsLayout page='settings/instances/add' label="Add instance">
|
<SettingsLayout page='settings/instances/add' label={pageLabel}>
|
||||||
<h1 id="add-an-instance-h1">Add instance</h1>
|
<h1 id="add-an-instance-h1">{pageLabel}</h1>
|
||||||
|
|
||||||
<div class="add-new-instance">
|
<div class="add-new-instance">
|
||||||
<form on:submit='onSubmitInstance(event)' aria-labelledby="add-an-instance-h1">
|
<form on:submit='onSubmitInstance(event)' aria-labelledby="add-an-instance-h1">
|
||||||
|
@ -109,6 +109,9 @@
|
||||||
hasIndexedDB: true,
|
hasIndexedDB: true,
|
||||||
hasLocalStorage: true
|
hasLocalStorage: true
|
||||||
}),
|
}),
|
||||||
|
computed: {
|
||||||
|
pageLabel: ({ $isUserLoggedIn }) => $isUserLoggedIn ? 'Add instance' : 'Log in'
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSubmitInstance (event) {
|
onSubmitInstance (event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<Title name="Add instance" settingsPage={true} />
|
<Title name={$isUserLoggedIn ? 'Add instance' : 'Log in'} settingsPage={true} />
|
||||||
|
|
||||||
<LazyPage {pageComponent} {params} />
|
<LazyPage {pageComponent} {params} />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue