Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/views/DashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const ERRORS: Record<string, string> = {
exchange_failed: 'Could not complete the connection. Please try again.',
}

/** Where the page's own code lives; linked from the footer. */
const SOURCE_URL = 'https://github.com/roboloop/only-dashboard'

const syncNote = computed(() => {
if (session.loading || !session.fetchedAt) return 'syncing…'
return `synced ${relativeTime(session.fetchedAt, now.value)} ago`
Expand Down Expand Up @@ -104,8 +107,14 @@ async function disconnect(id: ProviderId) {
<TitleBlock class="ruled" />
<CategoryBlock class="ruled" />

<footer v-if="session.connectedCount > 0" class="foot">
<button type="button" class="signout" @click="session.logout()">
<footer class="foot">
<a class="source" :href="SOURCE_URL" target="_blank" rel="noopener">SOURCE ↗</a>
<button
v-if="session.connectedCount > 0"
type="button"
class="signout"
@click="session.logout()"
>
SIGN OUT OF EVERYTHING
</button>
</footer>
Expand Down Expand Up @@ -171,6 +180,20 @@ async function disconnect(id: ProviderId) {
margin: 26px 26px 0;
padding-top: 22px;
border-top: 1px solid var(--border-rule);
display: flex;
align-items: center;
justify-content: space-between;
}

.source {
font: 500 var(--fs-micro) / 1 var(--font-sans);
letter-spacing: 0.06em;
color: var(--text-dim);
text-decoration: none;
}

.source:hover {
color: var(--accent);
}

.signout {
Expand Down
11 changes: 11 additions & 0 deletions src/views/__tests__/DashboardView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ describe('DashboardView', () => {
expect(wrapper.findAll('a.dashboard')).toHaveLength(1)
})

it('links to the source repository even with nothing connected', async () => {
stubApi([providerState()])
const wrapper = await mountView()

const link = wrapper.get('a.source')
expect(link.attributes('href')).toBe('https://github.com/roboloop/only-dashboard')
expect(link.attributes('target')).toBe('_blank')
expect(link.text()).toContain('SOURCE')
expect(wrapper.text()).not.toContain('SIGN OUT')
})

it('pre-fills the title input with the current shared title', async () => {
stubApi([providerState({ connected: true, streamTitle: 'Current title' })])
const wrapper = await mountView()
Expand Down
Loading