Skip to content
Draft
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
13 changes: 13 additions & 0 deletions core/messages/about/en.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { i18n } from '../../i18n.ts'

export const aboutMessages = i18n('about', {
allCiActionsAuthors: 'all CI actions authors',
allDependenciesAuthors: 'All our dependencies authors',
allNpmDependenciesAuthors: 'all npm dependencies authors',
closeCredits: 'Close credits',
companies: 'Companies',
contributors: 'Contributors',
credits: 'Credits',
devOpsTeam: 'manually list of people who helped with Docker images, nginx, etc',
evilMartians: 'Evil Martians',
hhLabs: 'h+h lab',
opensource:
'This app is open source. Anyone, including developers and LLMs, can see exactly how it works and verify our promises.',
openSourceCommunity: 'Open Source Community',
pageTitle: 'About',
reportIssue: 'Report an issue',
slowReader: 'Slow Reader',
specialThanks: 'Special Thanks',
version: 'App version',
viewSources: 'View source code'
})
47 changes: 45 additions & 2 deletions core/pages/about.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,55 @@
import { VERSION } from '@slowreader/api'
import { atom } from 'nanostores'

import { createPage } from './common.ts'
import { contributorsMock } from './contributors.ts'

export type Contributor = {
avatar_url: string
contributions: number
html_url: string
id: number
login: string
type: string
}

const EXCLUDED_LOGINS = new Set(['actions-user', 'dependabot[bot]'])

async function getContributors(): Promise<Contributor[]> {
let response = await fetch(
'https://api.github.com/repos/hplush/slowreader/contributors'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do it in scripts, since sending new HTTP request on every page open will consume too many resources for static content like this one.

)
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}

let data = (await response.json()) as Contributor[]
return data.filter(contributor => !EXCLUDED_LOGINS.has(contributor.login))
}

export const aboutPage = createPage('about', () => {
let $credits = atom<Contributor[] | null>(null)
let $showCredits = atom<boolean>(false)

getContributors()
.then(data => {
$credits.set(data)
})
.catch(() => {
$credits.set(contributorsMock)
})

function toggleCredits(): void {
$showCredits.set(!$showCredits.get())
}

return {
appVersion: VERSION,
exit() {},
params: {}
credits: $credits,
exit() { },
params: {},
showCredits: $showCredits,
toggleCredits
}
})

Expand Down
Loading
Loading