work on list of instances settings page
This commit is contained in:
parent
1582cd10e1
commit
af8cf63caa
|
@ -38,7 +38,7 @@
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--main-border);
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
|
|
|
@ -52,6 +52,19 @@ store.compute(
|
||||||
(currentInstance, loggedInInstances) => !!(currentInstance && Object.keys(loggedInInstances).includes(currentInstance))
|
(currentInstance, loggedInInstances) => !!(currentInstance && Object.keys(loggedInInstances).includes(currentInstance))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
store.compute(
|
||||||
|
'loggedInInstancesAsList',
|
||||||
|
['currentInstance', 'loggedInInstances', 'loggedInInstancesInOrder'],
|
||||||
|
(currentInstance, loggedInInstances, loggedInInstancesInOrder) => {
|
||||||
|
return loggedInInstancesInOrder.map(instanceName => {
|
||||||
|
return Object.assign({
|
||||||
|
current: currentInstance === instanceName,
|
||||||
|
name: instanceName
|
||||||
|
}, loggedInInstances[instanceName])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
if (process.browser && process.env.NODE_ENV !== 'production') {
|
if (process.browser && process.env.NODE_ENV !== 'production') {
|
||||||
window.store = store // for debugging
|
window.store = store // for debugging
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,29 @@
|
||||||
<SettingsLayout page='instances'>
|
<SettingsLayout page='instances'>
|
||||||
<h1>Instances</h1>
|
<h1>Instances</h1>
|
||||||
|
|
||||||
|
{{#if $isUserLoggedIn}}
|
||||||
|
<ul class="instances-list">
|
||||||
|
{{#each $loggedInInstancesAsList as instance}}
|
||||||
|
<li class="instance-card">
|
||||||
|
<span>{{instance.name}}</span>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
{{else}}
|
||||||
<p>Connect to an instance to start using Pinafore.</p>
|
<p>Connect to an instance to start using Pinafore.</p>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<form on:submit='onSubmit(event)'>
|
{{#if !$isUserLoggedIn}}
|
||||||
<label for="instanceInput">Instance name:</label>
|
<form class="add-new-instance" on:submit='onSubmit(event)'>
|
||||||
<input type="text" id="instanceInput" bind:value='$instanceNameInSearch' placeholder=''>
|
<label for="instanceInput">Instance name:</label>
|
||||||
<button class="primary" type="submit" id="submitButton">Add instance</button>
|
<input type="text" id="instanceInput" bind:value='$instanceNameInSearch' placeholder=''>
|
||||||
</form>
|
<button class="primary" type="submit" id="submitButton">Add instance</button>
|
||||||
|
</form>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<p>Don't have an instance? <a href="https://joinmastodon.org">Join Mastodon!</a></p>
|
{{#if !$isUserLoggedIn}}
|
||||||
|
<p>Don't have an instance? <a href="https://joinmastodon.org">Join Mastodon!</a></p>
|
||||||
|
{{/if}}
|
||||||
</SettingsLayout>
|
</SettingsLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<style>
|
<style>
|
||||||
|
@ -28,14 +42,14 @@
|
||||||
width: 250px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
form {
|
form.add-new-instance {
|
||||||
background: var(--form-bg);
|
background: var(--form-bg);
|
||||||
padding: 5px 10px 15px;
|
padding: 5px 10px 15px;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
border: 1px solid var(--form-border);
|
border: 1px solid var(--form-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
form label, form input, form button {
|
form.add-new-instance label, form.add-new-instance input, form.add-new-instance button {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 20px 5px;
|
margin: 20px 5px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue