2018-01-13 21:12:17 +01:00
|
|
|
<:Head>
|
|
|
|
<title>{{params.instanceName}}</title>
|
|
|
|
</:Head>
|
|
|
|
|
|
|
|
<Layout page='settings'>
|
|
|
|
<SettingsLayout page='settings/instances/{{params.instanceName}}' label="{{params.instanceName}}">
|
|
|
|
<h1>{{params.instanceName}}</h1>
|
2018-01-13 23:19:51 +01:00
|
|
|
|
|
|
|
{{#if currentUser}}
|
|
|
|
<h2>Logged in as:</h2>
|
|
|
|
<div class="current-user">
|
|
|
|
<img src="{{currentUser.avatar}}" />
|
|
|
|
<a rel="noopener" target="_blank" href="{{currentUser.url}}">@{{currentUser.acct}}</a>
|
|
|
|
<span class="acct-name">{{currentUser.display_name}}</span>
|
|
|
|
</div>
|
|
|
|
<h2>Theme:</h2>
|
|
|
|
<form class="theme-chooser">
|
2018-01-14 02:41:15 +01:00
|
|
|
{{#each themes as theme}}
|
|
|
|
<div class="theme-group">
|
|
|
|
<input type="radio" id="choice-theme-{{theme.name}}"
|
|
|
|
value="{{theme.name}}" checked="$currentTheme === theme.name"
|
|
|
|
bind:group="selectedTheme" on:change="onThemeChange()">
|
|
|
|
<label for="choice-theme-{{theme.name}}">{{theme.label}}</label>
|
|
|
|
</div>
|
|
|
|
{{/each}}
|
2018-01-13 23:19:51 +01:00
|
|
|
</form>
|
|
|
|
{{/if}}
|
2018-01-13 21:12:17 +01:00
|
|
|
</SettingsLayout>
|
|
|
|
</Layout>
|
2018-01-13 23:19:51 +01:00
|
|
|
<style>
|
|
|
|
.current-user {
|
|
|
|
padding: 20px;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
font-size: 1.3em;
|
|
|
|
}
|
|
|
|
.current-user img {
|
|
|
|
width: 64px;
|
|
|
|
height: 64px;
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
.current-user img, .current-user a, .current-user span {
|
|
|
|
margin-right: 20px;
|
|
|
|
}
|
|
|
|
.theme-chooser {
|
|
|
|
display: block;
|
|
|
|
padding: 20px;
|
|
|
|
line-height: 2em;
|
|
|
|
}
|
|
|
|
.theme-group {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.theme-chooser label {
|
|
|
|
margin: 2px 10px 0;
|
|
|
|
}
|
|
|
|
</style>
|
2018-01-13 21:12:17 +01:00
|
|
|
<script>
|
|
|
|
import { store } from '../../_utils/store'
|
|
|
|
import Layout from '../../_components/Layout.html'
|
|
|
|
import SettingsLayout from '../_components/SettingsLayout.html'
|
2018-01-13 23:19:51 +01:00
|
|
|
import { getCurrentUser } from '../../_utils/mastodon/user'
|
2018-01-14 02:41:15 +01:00
|
|
|
import { themes } from '../../_static/themes'
|
2018-01-13 21:12:17 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Layout,
|
|
|
|
SettingsLayout
|
|
|
|
},
|
2018-01-13 23:19:51 +01:00
|
|
|
store: () => store,
|
2018-01-14 02:41:15 +01:00
|
|
|
data: () => ({
|
|
|
|
themes: themes
|
|
|
|
}),
|
2018-01-13 23:19:51 +01:00
|
|
|
oncreate: async function () {
|
|
|
|
let currentInstanceData = this.store.get('currentInstanceData')
|
|
|
|
let currentUser = await getCurrentUser(currentInstanceData.name, currentInstanceData.access_token)
|
2018-01-14 02:41:15 +01:00
|
|
|
this.set({
|
|
|
|
currentUser: currentUser,
|
|
|
|
selectedTheme: this.store.get('currentTheme')
|
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onThemeChange () {
|
|
|
|
let newTheme = this.get('selectedTheme')
|
|
|
|
let instanceName = this.store.get('currentInstance')
|
|
|
|
let instanceThemes = this.store.get('instanceThemes')
|
|
|
|
instanceThemes[instanceName] = newTheme
|
|
|
|
this.store.set({instanceThemes: instanceThemes})
|
|
|
|
this.store.save()
|
|
|
|
}
|
2018-01-13 23:19:51 +01:00
|
|
|
}
|
2018-01-13 21:12:17 +01:00
|
|
|
}
|
|
|
|
</script>
|