Skip to content

Commit

Permalink
chore(web app): upgrade to Fresh 1.6.5 and Tailwind CSS
Browse files Browse the repository at this point in the history
Also move all Fresh files into `website/` directory
  • Loading branch information
inkwell-studio committed Mar 18, 2024
1 parent 06b1c17 commit c2deb52
Show file tree
Hide file tree
Showing 83 changed files with 1,963 additions and 793 deletions.
16 changes: 16 additions & 0 deletions .vscode/catechism-of-the-catholic-church.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"folders": [
{
"path": ".."
}
],
"settings": {
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false,
"editor.defaultFormatter": "denoland.vscode-deno",
"files.associations": {
"*.css": "tailwindcss"
}
}
}
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"denoland.vscode-deno",
"sastan.twind-intellisense"
"bradlc.vscode-tailwindcss",
"stivo.tailwind-fold"
]
}
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"request": "launch",
"name": "Web App",
"type": "node",
"program": "${workspaceFolder}/dev.ts",
"program": "${workspaceFolder}/website/dev.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": [
Expand Down Expand Up @@ -39,7 +39,7 @@
"runtimeArgs": [
"test",
"--inspect-brk",
"web/rendering.test.ts"
"website/web/rendering.test.ts"
],
"attachSimplePort": 9229
},
Expand Down
17 changes: 0 additions & 17 deletions .vscode/settings.json

This file was deleted.

38 changes: 38 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Dependencies

- [Deno](https://deno.land/)

## Useful tools

- [Deno extension for VS Code](https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno)
- see `.vscode/extensions.json` for recommeded extensions

## Main tasks

- `deno task pre-commit` (linting, testing, formatting, and artifact creation)
- `deno task build-mock-data`
- `deno task web-app-start`

See `deno.json` for all tasks.

## Committing to `master`

The `pre-commit` task should be successfully executed before committing to ensure that the code is linted, correct, and
formatted, and that the artifacts are kept in-sync with the source.

Commit messages should follow the following pattern:

```
type(scope): details
more details (optional)
```

Where `type` is one of:

- `feat` — for user-facing functionality additions and improvements
- `fix` — for bug fixes
- `refactor` — for code refactoring that does not substantially change user-facing functionality
- `chore` — for non-user-facing changes such build or configuration changes, or dependency updates
- `style` — for merely cosmetic code changes
- `docs` — for documentation changes
38 changes: 0 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,3 @@ It is available at [https://www.catholiccatechism.app/](https://www.catholiccate
- [Reddit Catechism bot](https://github.com/konohitowa/catebot)
- [Something that generates a random paragraph from the Catechism of the Catholic Church](https://github.com/regdoug/ccc)
- [Golang library of the Catechism of the Council of Trent](https://github.com/mborders/romanus)

## Development

### Dependencies

- [Deno](https://deno.land/)

### Useful tools

- [Deno extension for VS Code](https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno)

### Tasks

- `deno task pre-commit` (linting, testing, formatting, and artifact creation)
- `deno task build-mock-data`
- `deno task web-app-start`

### Committing to `master`

The `pre-commit` task should be successfully executed before committing to ensure that the code is linted, correct, and
formatted, and that the artifacts are kept in-sync with the source.

Commit messages should follow the following pattern:

```
type(scope): details
more details (optional)
```

Where `type` is one of:

- `feat` — for user-facing functionality additions and improvements
- `fix` — for bug fixes
- `refactor` — for code refactoring that does not substantially change user-facing functionality
- `build` — for build changes
- `style` — for merely cosmetic code changes
- `docs` — for documentation changes
36 changes: 19 additions & 17 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
# Tasks to complete now

- [ ] update the intro page if appropriate
- [ ] improve UI construction
- [ ] implement a dark mode toggle
- [ ] light/dark/high-contrast mode toggle
- [ ] consider using a Layout for the `[...path].tsx` rendering
- [ ] use Partials in all appropriate spots
- [ ] handle RTL languages
- merge

- [ ] separate the state logic into obvious client-side and server-side files (to aid with developer understanding, and
to mitigate potential bugs)
- [ ] update UI
- [ ] fonts to consider
- [ ] Bookman
- [ ] Alegreya
- [ ] accomodate Forced Colors mode (see Polypane blog)
- [ ] dark mode: try to avoid the "window blending" problem (cannot tell where the browser window starts and another
application window begins)
- [ ] consider all notes about colors found elsewhere in this file

- [ ] update the intro page if appropriate
- merge

- [ ] set caching headers for the fonts (and any other static files?)
- merge

- [ ] upgrade to Fresh 1.5.x
- check for deployment errors & verify the intro page works

- [ ] consider using a Deno Fresh layout for the `[...path].tsx` rendering

- [ ] translations: always use a server-side component so data isn't sent up to the client unnecessarily
- [ ] UI changes: handle RTL languages
- [ ] implement Action bar
- Table of Contents
- "Home" (to a new "Dashboard" page (at `/en`): TOC with a link to the current "intro" page)
Expand Down Expand Up @@ -60,7 +67,6 @@
- [ ] consider improving artifact management
- should artifacts not be commited, and instead be built during deployment?
- [ ] UI: style for LTR and RTL text
- [ ] add dark-mode functionality
- [ ] add e2e UI tests to validate links
- [ ] add a UI language switcher
- [ ] update all user-facing text to be
Expand All @@ -77,16 +83,12 @@
- [ ] routing
- [ ] to in-page anchor tags
- UI:
- consider using Twind presets:
- https://twind.style/presets#official-presets
- consider if any of the official Tailwind presets would be useful:
- https://tailwindcss.com/docs/plugins#official-plugins
- consider using Radix UI things:
- https://twind.style/preset-radix-ui
- https://www.radix-ui.com/colors
- https://www.radix-ui.com/colors
- https://www.radix-ui.com/
- https://icons.radix-ui.com/
- [ ] light/dark/high-contrast mode toggle
- [ ] dark mode: try to avoid the "window blending" problem (cannot tell where the browser window starts and another
application window begins)
- [ ] consider using the following colors:
- [ ] #E86D82 (red-pink)
- [ ] implement unimplemented tests
Expand Down
12 changes: 0 additions & 12 deletions catechism-of-the-catholic-church.code-workspace

This file was deleted.

2 changes: 1 addition & 1 deletion catechism/artifact-builders/paragraph-number-to-url-map.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CatechismStructure, ParagraphNumberUrlMap } from '../source/types/types.ts';
import { getAllParagraphs } from '../source/utils/content.ts';
import { getUrl } from '../../web/routing-server.ts';
import { getUrl } from '../../website/logic/server/routing.ts';

export function build(catechism: CatechismStructure): ParagraphNumberUrlMap {
const urlMap: ParagraphNumberUrlMap = {};
Expand Down
2 changes: 1 addition & 1 deletion catechism/artifact-builders/path-id-to-content-map.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CatechismStructure, PathIdContentMap, SemanticPathPathIdMap } from '../source/types/types.ts';
import { getContentForRendering } from '../../web/rendering.ts';
import { getContentForRendering } from '../../website/logic/server/rendering.ts';

export function build(renderablePathMap: SemanticPathPathIdMap, catechism: CatechismStructure): PathIdContentMap {
const contentMap: PathIdContentMap = {};
Expand Down
2 changes: 1 addition & 1 deletion catechism/artifact-builders/table-of-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '../source/types/types.ts';
import { getFinalContent, getInBrief, getMainContent, getParagraphs } from '../source/utils/content.ts';
import { buildSemanticPath, getSemanticPathSource } from '../source/utils/semantic-path.ts';
import { getUrl } from '../../web/routing-server.ts';
import { getUrl } from '../../website/logic/server/routing.ts';

//#region builders
export function build(catechism: CatechismStructure): TableOfContentsType {
Expand Down
2 changes: 1 addition & 1 deletion catechism/artifacts/paragraph-number_to_content.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertExists, assertStrictEquals } from '$deno/testing/asserts.ts';
import { assertExists, assertStrictEquals } from '$deno/assert/mod.ts';

import { getAllParagraphs, getCatechism } from '../source/utils/content.ts';
import { CatechismStructure, ParagraphNumberContentMap } from '../source/types/types.ts';
Expand Down
2 changes: 1 addition & 1 deletion catechism/artifacts/path-id_to_renderable-nodes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, assertStrictEquals } from '$deno/testing/asserts.ts';
import { assert, assertStrictEquals } from '$deno/assert/mod.ts';
import { RenderableNode } from '../source/types/renderable-node.ts';
import { RenderableNodeMap } from '../source/types/types.ts';
import { getRenderableNodeMap } from '../source/utils/artifacts.ts';
Expand Down
2 changes: 1 addition & 1 deletion catechism/artifacts/renderable-path-id_to_content.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertStrictEquals, fail } from '$deno/testing/asserts.ts';
import { assertStrictEquals, fail } from '$deno/assert/mod.ts';

import { getAllOfProperty, getAllPathIDs, getCatechism } from '../source/utils/content.ts';
import { CatechismStructure, PathID, PathIdContentMap, SemanticPathPathIdMap } from '../source/types/types.ts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertStrictEquals } from '$deno/testing/asserts.ts';
import { assertStrictEquals } from '$deno/assert/mod.ts';
import { SemanticPathPathIdMap } from '../source/types/semantic-path-path-id-map.ts';
import { getRenderablePathMap } from '../source/utils/artifacts.ts';
import { getSupportedLanguages } from '../source/utils/language.ts';
Expand Down
2 changes: 1 addition & 1 deletion catechism/artifacts/table-of-contents.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, assertExists, assertStrictEquals } from '$deno/testing/asserts.ts';
import { assert, assertExists, assertStrictEquals } from '$deno/assert/mod.ts';

import { CatechismStructure, TableOfContentsEntry, TableOfContentsType } from '../source/types/types.ts';
import { getTableOfContents } from '../source/utils/artifacts.ts';
Expand Down
2 changes: 1 addition & 1 deletion catechism/content/catechism-structure.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, assertNotMatch, assertStrictEquals } from '$deno/testing/asserts.ts';
import { assert, assertNotMatch, assertStrictEquals } from '$deno/assert/mod.ts';

import {
BibleReference,
Expand Down
2 changes: 1 addition & 1 deletion catechism/content/catechism-text-all.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertNotMatch, assertNotStrictEquals, assertStrictEquals, fail } from '$deno/testing/asserts.ts';
import { assertNotMatch, assertNotStrictEquals, assertStrictEquals, fail } from '$deno/assert/mod.ts';

import { CatechismText, getText } from './test-utils.ts';
import { PathID } from '../source/types/types.ts';
Expand Down
4 changes: 2 additions & 2 deletions catechism/content/catechism-text-en.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Catechism from './catechism-en.json' assert { type: 'json' };
import Catechism from './catechism-en.json' with { type: 'json' };

import { assertNotMatch, assertStrictEquals, assertStringIncludes } from '$deno/testing/asserts.ts';
import { assertNotMatch, assertStrictEquals, assertStringIncludes } from '$deno/assert/mod.ts';

import { errorMessage, getText, testCharacters, testLines } from './test-utils.ts';
import { CatechismStructure, Language, PathID } from '../source/types/types.ts';
Expand Down
4 changes: 2 additions & 2 deletions catechism/content/catechism-text-es.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Catechism from './catechism-es.json' assert { type: 'json' };
import Catechism from './catechism-es.json' with { type: 'json' };

import { assertStrictEquals } from '$deno/testing/asserts.ts';
import { assertStrictEquals } from '$deno/assert/mod.ts';

import { CatechismStructure, Language } from '../source/types/types.ts';

Expand Down
4 changes: 2 additions & 2 deletions catechism/content/catechism-text-la.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Catechism from './catechism-la.json' assert { type: 'json' };
import Catechism from './catechism-la.json' with { type: 'json' };

import { assertStrictEquals } from '$deno/testing/asserts.ts';
import { assertStrictEquals } from '$deno/assert/mod.ts';

import { CatechismStructure, Language } from '../source/types/types.ts';

Expand Down
2 changes: 1 addition & 1 deletion catechism/mock-data/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '../../source/utils/content.ts';
import { getContainerDesignator } from '../../source/utils/path-id.ts';
import { buildSemanticPath, getSemanticPathSource } from '../../source/utils/semantic-path.ts';
import { getUrl } from '../../../web/routing-server.ts';
import { getUrl } from '../../../website/logic/server/routing.ts';

//#region top-level functions
export function buildMockData(): CatechismStructure {
Expand Down
2 changes: 1 addition & 1 deletion catechism/source/types/enums.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertStrictEquals } from '$deno/testing/asserts.ts';
import { assertStrictEquals } from '$deno/assert/mod.ts';
import { Artifact, BibleBook, Container, Content, Language, OtherSourceEnum, ReferenceEnum } from './types.ts';

console.log('\nEnums ...');
Expand Down
2 changes: 1 addition & 1 deletion catechism/source/utils/content.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from '$deno/testing/asserts.ts';
import { assertEquals } from '$deno/assert/mod.ts';

import { getParagraphNumbers } from './content.ts';

Expand Down
2 changes: 1 addition & 1 deletion catechism/source/utils/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {

export async function getCatechism(language: Language): Promise<CatechismStructure> {
const file = `catechism-${language}.json`;
const catechism = await import(`../../content/${file}`, { assert: { type: 'json' } });
const catechism = await import(`../../content/${file}`, { with: { type: 'json' } });
return catechism.default;
}

Expand Down
2 changes: 1 addition & 1 deletion catechism/source/utils/path-id.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, assertEquals, assertStrictEquals, assertThrows } from '$deno/testing/asserts.ts';
import { assert, assertEquals, assertStrictEquals, assertThrows } from '$deno/assert/mod.ts';

import {
getContainerDesignator,
Expand Down
2 changes: 1 addition & 1 deletion catechism/source/utils/semantic-path.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertStrictEquals } from '$deno/testing/asserts.ts';
import { assertStrictEquals } from '$deno/assert/mod.ts';

import { buildSemanticPath, getSemanticPathSource } from './semantic-path.ts';
import {
Expand Down
2 changes: 1 addition & 1 deletion catechism/source/utils/semantic-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SemanticPathSource,
Subarticle,
} from '../types/types.ts';
import { translate } from '../../../web/translation.ts';
import { translate } from '../../../website/logic/shared/translation.ts';

/**
* @param ancestors a list of ancestors of `child`, in descending order (i.e. `ancestors[i]` is the parent of `ancestors[i+1]`)
Expand Down

0 comments on commit c2deb52

Please sign in to comment.