Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#115 removed unused type import #116

Merged
merged 2 commits into from
Oct 1, 2023
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
6 changes: 5 additions & 1 deletion src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
body {
overflow-x: hidden;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif;
font-family:
-apple-system,
BlinkMacSystemFont,
Segoe UI,
sans-serif;
line-height: 1.5;
/* https://modern-fluid-typography.vercel.app */
font-size: clamp(1rem, 0.5vw + 1rem, 1.2rem);
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8" />
Expand Down
6 changes: 3 additions & 3 deletions src/lib/azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const to_str = (str: unknown) => (str ? String(str) : undefined)
async function azure_post_new_records(
base_id: string,
table_id: string,
data: { [key: string]: unknown }
data: { [key: string]: unknown },
) {
const response = await fetch(azure_url(base_id, table_id), {
method: `POST`,
Expand All @@ -29,7 +29,7 @@ async function azure_post_new_records(
export async function prepare_signup_data_for_azure(
data: SignupStore,
chapter_base_id: string,
test = false
test = false,
): Promise<Response> {
const table = data.type.value === `student` ? `Studenten` : `Schüler`

Expand Down Expand Up @@ -109,7 +109,7 @@ export async function prepare_signup_data_for_azure(
export async function signup_form_submit_handler(
fields_to_validate: (keyof SignupStore)[],
chapters: Chapter[],
err_msg: Record<string, string>
err_msg: Record<string, string>,
): Promise<{ error?: Error; success?: boolean }> {
// handles form validation and Plausible event reporting
const signup_data = get(signup_store)
Expand Down
8 changes: 4 additions & 4 deletions src/lib/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const prefixSlug = (prefix: string) => (obj: Page | Post) => {

export async function airtable_fetch(
query: string,
options = {}
options = {},
): Promise<Record<string, unknown>> {
const apiKey = import.meta.env.VITE_AIRTABLE_CHAPTER_BASE_APP_ID

Expand All @@ -24,7 +24,7 @@ export async function airtable_fetch(
headers: { 'Content-Type': `application/json` },
body: JSON.stringify({ query }),
...options,
}
},
)

const { data, error } = await response.json()
Expand Down Expand Up @@ -81,7 +81,7 @@ export async function fetch_chapters(): Promise<Chapter[]> {

export async function base64_thumbnail(
url: string,
options?: { type?: string; w?: number; h?: number }
options?: { type?: string; w?: number; h?: number },
): Promise<string> {
const { type = `jpg`, w = 10, h = 10 } = options ?? {}

Expand Down Expand Up @@ -262,7 +262,7 @@ function title_to_slug(itm: Record<string, unknown> & { title: string }) {

export async function fetch_yaml_list(
title: string,
slugPrefix: string
slugPrefix: string,
): Promise<Record<string, unknown>[]> {
const list = await fetch_yaml(title)
return list.map(parse_body).map(title_to_slug).map(prefixSlug(slugPrefix))
Expand Down
6 changes: 3 additions & 3 deletions src/lib/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ export const colorModeKey = `color-mode`
type ColorMode = `light` | `dark` | `system`

export const colorMode = writable<ColorMode>(
(has_local_store && localStorage[colorModeKey]) || `system`
(has_local_store && localStorage[colorModeKey]) || `system`,
)

colorMode.subscribe(
(val: ColorMode) => has_local_store && (localStorage[colorModeKey] = val)
(val: ColorMode) => has_local_store && (localStorage[colorModeKey] = val),
)

export const signupStore = session_store<SignupStore>(
`SignupStore`,
{} as SignupStore
{} as SignupStore,
)

export const microcopy = writable({})
2 changes: 1 addition & 1 deletion src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const load = async () => {
const social = await fetch_yaml(`Social`)
// don't show partner orgs in nav
const chapters = (await fetch_chapters()).filter(
(chap) => chap.status != `partner`
(chap) => chap.status != `partner`,
)
const smallTexts = await fetch_yaml(`smallTexts`)
microcopy.set(smallTexts)
Expand Down
12 changes: 0 additions & 12 deletions src/routes/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
import { fetch_chapters, fetch_page } from '$lib/fetch'
import type { PageServerLoad } from './$types'

export const load = async () => {
return {
page: fetch_page(`/`),
chapters: fetch_chapters(),
// ...airtable_fetch(
// `{
// students: studentenStatistiken {
// id
// }
// pupils: schuelerStatistiken {
// id
// }
// }`,
// { cache: `force-cache` }
// ),
}
}
10 changes: 5 additions & 5 deletions src/utils/contentful.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ export async function search_string_in_content_type(args) {
const env = await space.getEnvironment(`master`)
let { items } = await env.getEntries({ content_type: contentType })
items = items.filter((item) =>
item?.fields[field][locale]?.includes(searchTerm)
item?.fields[field][locale]?.includes(searchTerm),
)
items = items.map((item) => item.fields.slug[locale])
console.log(
`'${contentType}' entries containing '${searchTerm}' in field '${field}.${locale}':`,
items
items,
)
} catch (error) {
console.error(error)
Expand Down Expand Up @@ -103,16 +103,16 @@ export async function replace_string_in_content_type(args) {

itm.fields[field][locale] = itm?.fields[field][locale]?.replaceAll(
searchTerm,
replaceTerm
replaceTerm,
)
if (dryRun) {
console.log(
`new ${field}.${locale} of ${contentType} ${itm?.fields?.title.de} after replacement: ${itm.fields[field][locale]}`
`new ${field}.${locale} of ${contentType} ${itm?.fields?.title.de} after replacement: ${itm.fields[field][locale]}`,
)
} else {
await itm.update()
console.log(
`performed replacement in ${contentType} ${itm?.fields?.title.de}`
`performed replacement in ${contentType} ${itm?.fields?.title.de}`,
)
// await itm.publish()
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/deeplTranslate.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function translateContentfulEntries() {
const title = itm.fields.title[sourceLocale]
// eslint-disable-next-line no-console
console.log(
`successfully translated ${contentType} '${title}' to ${targetLocale}`
`successfully translated ${contentType} '${title}' to ${targetLocale}`,
)
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/googleTranslate.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function translateContentfulEntries() {
const title = itm.fields.title[sourceLocale]
// eslint-disable-next-line no-console
console.log(
`successfully translated ${contentType} '${title}' to ${targetLocale}`
`successfully translated ${contentType} '${title}' to ${targetLocale}`,
)
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Page } from '@playwright/test'
export async function fill_select(
page: Page,
selector: string,
values: string[]
values: string[],
) {
for (const value of values) {
await page.fill(selector, value)
Expand Down
2 changes: 1 addition & 1 deletion tests/pupil-form.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test(`pupil signup form can be submitted after filling all required fields`, asy

await page.fill(
`#emailContact`,
`florian.kleinicke@studenten-bilden-schueler.de`
`florian.kleinicke@studenten-bilden-schueler.de`,
)

await page.fill(`#orgContact`, `Privat`)
Expand Down
Loading