Skip to content

Commit c7d2433

Browse files
Reapply "Reapply "Merge branch 'main' into dev""
This reverts commit 612c43f.
1 parent 612c43f commit c7d2433

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2086
-522
lines changed

.github/workflows/code-quality.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ jobs:
3939
FEIDE_TOKEN_ENDPOINT: "https://auth.dataporten.no/oauth/token"
4040
FEIDE_USERINFO_ENDPOINT: "https://auth.dataporten.no/openid/userinfo"
4141
NEXT_PUBLIC_SITE_URL: "http://localhost:3000"
42+
LHCI_TOKEN: ${{ secrets.LHCI_BUILD_TOKEN }}
4243
steps:
4344
- name: Checkout
4445
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 20
48+
- name: Fetch base_ref HEAD
49+
run: git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
4550
- name: Setup bun
4651
uses: oven-sh/setup-bun@v2
4752
with:
@@ -54,5 +59,5 @@ jobs:
5459
env:
5560
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
5661
run: |
57-
bun add -g @lhci/cli@0.13.x
62+
bun add -g @lhci/cli@0.14.x
5863
lhci autorun

.github/workflows/deploy-script.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on:
2525
jobs:
2626
script:
2727
name: Script
28-
runs-on: ubuntu-latest
28+
runs-on: self-hosted
2929
environment: ${{ inputs.environment }}
3030
steps:
3131
- uses: appleboy/[email protected]

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ public/robots.txt
2020

2121
# data
2222
/data
23+
24+
# Ignore husky files, see PR #54
25+
/.husky/*

.husky/_/pre-commit

Lines changed: 0 additions & 60 deletions
This file was deleted.

.husky/_/prepare-commit-msg

Lines changed: 0 additions & 60 deletions
This file was deleted.

biome.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"enabled": true,
1212
"rules": {
1313
"recommended": true,
14+
"a11y": {
15+
"useSemanticElements": "off"
16+
},
1417
"nursery": {
1518
"useSortedClasses": {
1619
"level": "warn",

bun.lockb

-6.61 KB
Binary file not shown.

global.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
// Use type safe message keys with `next-intl`
2-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
32
type Messages = typeof import('./messages/en.json');
4-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
53
declare interface IntlMessages extends Messages {}

lefthook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pre-commit:
22
commands:
33
check:
4-
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
4+
glob: "*.{js,ts,tsx,json}"
55
stage_fixed: true
66
run: bunx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}

lighthouserc.cjs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const PAGES_EXCLUDED = ['news', 'storage'];
2+
3+
// Do not convert into an ES6 export.
4+
// lighthouse-ci (as of 0.14.0) uses require() to import, and this is not supported with ES6 modules.
5+
module.exports = {
6+
ci: {
7+
collect: {
8+
url: [
9+
'http://localhost:3000/en/', // Trailing slash required, else the regex for default lighthouse rules won't catch this one
10+
'http://localhost:3000/en/about',
11+
'http://localhost:3000/en/events',
12+
'http://localhost:3000/en/news',
13+
'http://localhost:3000/en/news/1',
14+
'http://localhost:3000/en/storage',
15+
'http://localhost:3000/en/storage/shopping-cart',
16+
],
17+
startServerCommand: 'bun run start',
18+
},
19+
upload: {
20+
target: 'lhci',
21+
serverBaseUrl: 'https://lhci.hackerspace-ntnu.no', // build token is set by the GH Action
22+
},
23+
assert: {
24+
assertMatrix: [
25+
{
26+
matchingUrlPattern: `http://.*/en/(?!${PAGES_EXCLUDED.join('|')}).*`, // match all routes, except for pages with special rules. See https://github.com/GoogleChrome/lighthouse-ci/issues/511 and https://github.com/GoogleChrome/lighthouse-ci/issues/208#issuecomment-784501105
27+
preset: 'lighthouse:recommended',
28+
assertions: {
29+
'bf-cache': 'off',
30+
'color-contrast': 'off',
31+
'heading-order': 'off',
32+
'largest-contentful-paint': 'off',
33+
'render-blocking-resources': 'off',
34+
},
35+
},
36+
{
37+
matchingUrlPattern: 'http://.*/en/news.*',
38+
preset: 'lighthouse:recommended',
39+
assertions: {
40+
'bf-cache': 'off',
41+
'color-contrast': 'off',
42+
'heading-order': 'off',
43+
'largest-contentful-paint': 'off',
44+
'render-blocking-resources': 'off',
45+
interactive: 'off',
46+
'uses-responsive-images': 'off', // Should be removed when we obtain images from backend
47+
},
48+
},
49+
{
50+
matchingUrlPattern: 'http://.*/en/storage.*',
51+
preset: 'lighthouse:recommended',
52+
assertions: {
53+
'bf-cache': 'off',
54+
'color-contrast': 'off',
55+
'heading-order': 'off',
56+
'largest-contentful-paint': 'off',
57+
'render-blocking-resources': 'off',
58+
'unused-javascript': 'off',
59+
'cumulative-layout-shift': 'off', // We don't always know how many items are in the cart, which can lead to layout shifts when loading completes
60+
'max-potential-fid': 'off',
61+
},
62+
},
63+
],
64+
},
65+
},
66+
};

lighthouserc.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

messages/en.json

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@
99
"next": "Next",
1010
"goToNextPage": "Go to next page",
1111
"morePages": "More pages",
12-
"page": "page"
12+
"page": "page",
13+
"category": "category",
14+
"sort": "sort",
15+
"photoOf": "Photo of {name}"
16+
},
17+
"error": {
18+
"notFound": "404 - Page not found",
19+
"notFoundDescription": "Oops! Looks like this page got lost in cyberspace.",
20+
"error": "Oops! Something went wrong",
21+
"errorDescription": "Don't worry, our best hackers are on it!",
22+
"goToHomepage": "Return to homepage",
23+
"tryAgain": "Try again"
1324
},
1425
"layout": {
1526
"hackerspaceHome": "Hackerspace homepage",
@@ -52,13 +63,15 @@
5263
},
5364
"storage": {
5465
"title": "Storage",
66+
"searchPlaceholder": "Search for product...",
5567
"card": {
5668
"quantityInfo": "{quantity} units",
57-
"addToCart": "Add to cart"
69+
"addToCart": "Add to cart",
70+
"removeFromCart": "Remove from cart"
5871
},
5972
"select": {
73+
"ariaLabel": "Select how to filter the storage items",
6074
"filters": "Filters",
61-
"defaultPlaceholder": "Sort results",
6275
"popularity": "Popularity",
6376
"sortDescending": "Inventory (descending)",
6477
"sortAscending": "Inventory (ascending)",
@@ -72,8 +85,43 @@
7285
"peripherals": "PC peripherals",
7386
"miniPC": "Mini PC"
7487
},
88+
"searchParams": {
89+
"popularity": "popularity",
90+
"descending": "descending",
91+
"ascending": "ascending",
92+
"name": "name",
93+
"cables": "cables",
94+
"sensors": "sensors",
95+
"peripherals": "peripherals",
96+
"miniPC": "minipc"
97+
},
7598
"tooltips": {
7699
"viewShoppingCart": "View shopping cart"
100+
},
101+
"shoppingCart": {
102+
"title": "Shopping Cart",
103+
"productId": "Product ID",
104+
"productName": "Product Name",
105+
"location": "Location",
106+
"unitsAvailable": "Units available",
107+
"tableDescription": "A list of your shopping cart items.",
108+
"backToStorage": "Back to storage",
109+
"cartEmpty": "Your shopping cart is empty.",
110+
"clearCart": "Empty shopping cart",
111+
"cancel": "Cancel",
112+
"clear": "Clear",
113+
"clearCartDescription": "Are you sure you want to clear your shopping cart? All items will be removed.",
114+
"borrowNow": "Borrow now",
115+
"amountOfItemARIA": "Select number of this item"
116+
},
117+
"loanForm": {
118+
"name": "Name",
119+
"email": "Email",
120+
"phoneNumber": "Phone number",
121+
"phoneNumberDescription": "Phone number for contact. Include country code if the number isn't Norwegian.",
122+
"returnBy": "Return by",
123+
"returnByDescription": "Select how long you would like to borrow the item for.",
124+
"submit": "Submit"
77125
}
78126
}
79127
}

0 commit comments

Comments
 (0)