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

Latest changes into main #57

Merged
merged 134 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
400f698
refactor: Move layout back to storage page
ZeroWave022 Aug 29, 2024
6ecb39e
feat: Add shopping cart page with a table
ZeroWave022 Aug 29, 2024
cb159c1
build: Add usehooks-ts
ZeroWave022 Sep 6, 2024
82dbb23
feat: Add AddToCartButton
ZeroWave022 Sep 6, 2024
7d856e8
feat: Add dynamic shopping cart which loads info from LocalStorage
ZeroWave022 Sep 6, 2024
a77ce28
feat: AddToCartButton updates dynamically, saves to LocalStorage
ZeroWave022 Sep 7, 2024
5666ae1
feat: Make shopping cart button clickable
ZeroWave022 Sep 7, 2024
bee1c23
feat: Add a back to storage button on the shopping cart page
ZeroWave022 Sep 7, 2024
0a95fd7
refactor: Move item cards to own component
ZeroWave022 Sep 12, 2024
7dacf19
fix: AddToCartButton will now update on page change
ZeroWave022 Sep 12, 2024
5cc0683
fix!: Only save ids in LocalStorage instead of item objects
ZeroWave022 Sep 13, 2024
f368ff7
fix: Show loading skeleton when shopping cart table is loading
ZeroWave022 Sep 13, 2024
cd78df7
feat: Add buttons to remove items from cart
ZeroWave022 Sep 13, 2024
27180b1
feat: Add clear cart button
ZeroWave022 Sep 13, 2024
3644b18
fix: Add padding to cart buttons
ZeroWave022 Sep 13, 2024
68ee11d
feat: Add categories to search params
ZeroWave022 Sep 15, 2024
71b3cc0
feat: Add sorting to search params
ZeroWave022 Sep 15, 2024
a9ab1a9
fix: Use search params for default filters
ZeroWave022 Sep 15, 2024
4dac0e6
feat: Add WIP LoanForm
ZeroWave022 Sep 18, 2024
7404d42
feat: Add LoanForm
ZeroWave022 Sep 19, 2024
984def6
fix: Translate LoanForm title
ZeroWave022 Sep 19, 2024
80b1b0b
Merge remote-tracking branch 'origin/main' into storage-shopping-cart
ZeroWave022 Sep 19, 2024
5b44dc5
fix: Lint with biome
ZeroWave022 Sep 19, 2024
849926e
refactor: Newline after use client, remove unused dependencies
ZeroWave022 Sep 19, 2024
1625305
refactor: Append Icon to lucide icon names, fix typos
ZeroWave022 Sep 19, 2024
4d8e003
fix: Dynamic alt text for ItemCards
ZeroWave022 Sep 19, 2024
9c64980
refactor: Reduce repeated code, show message if shopping cart is empty
ZeroWave022 Sep 19, 2024
cc4c8f4
fix: Show only one language in search params
ZeroWave022 Sep 20, 2024
34e9820
refactor: Move storage to route group, remove searchParams prop
ZeroWave022 Sep 20, 2024
9792316
feat: Add loading page to shopping cart
ZeroWave022 Sep 20, 2024
0994ef4
refactor: Lint with biome
ZeroWave022 Sep 20, 2024
4b84038
Merge remote-tracking branch 'origin/main' into storage-shopping-cart
ZeroWave022 Sep 20, 2024
f1a904e
refactor: Use useId instead of manually generating keys for loading s…
ZeroWave022 Sep 22, 2024
c227353
fix: lockfile
michaelbrusegard Sep 22, 2024
17afc70
chore: import useId alone like other hooks
michaelbrusegard Sep 22, 2024
826789e
refactor: Use TableSkeleton in storage page loading
ZeroWave022 Sep 22, 2024
83e07c0
fix: Wrap client components in Suspense
ZeroWave022 Sep 22, 2024
57f98e8
fix: Do not use client components (PaginationCarousel) in layouts
ZeroWave022 Sep 22, 2024
cc022f3
chore: lint
ZeroWave022 Sep 22, 2024
63816fb
fix: change import from parsers to server for deprecation warnings
michaelbrusegard Sep 22, 2024
200ad22
chore: remove unecessary item folder
michaelbrusegard Sep 22, 2024
7b86f10
ci: add storage page to lighthouse checks
michaelbrusegard Sep 22, 2024
815779a
fix: shopping cart lighthouse page
michaelbrusegard Sep 22, 2024
eaac03e
fix: input font size on mobile causing zoom in
michaelbrusegard Sep 23, 2024
b9ec539
chore: restructure components directories
michaelbrusegard Sep 23, 2024
baf7723
fix: tiny refactors
michaelbrusegard Sep 23, 2024
1c2569d
fix: route groups setup
michaelbrusegard Sep 23, 2024
7e51c90
feat: fix and simplify search bar component
michaelbrusegard Sep 23, 2024
a4450c1
chore: add placehoder to search in storage
michaelbrusegard Sep 23, 2024
15c6756
feat: error and not found page
michaelbrusegard Sep 25, 2024
cd45a5f
fix: Set default sorting to popularity
ZeroWave022 Sep 25, 2024
ded225e
fix: ItemCard image scaling out of proportions
ZeroWave022 Sep 25, 2024
28bf06e
fix: Apply ARIA labels, fix item card font
ZeroWave022 Sep 25, 2024
234eadf
feat: Select how many items you would like to loan, fix skeletons
ZeroWave022 Sep 25, 2024
9a3d399
fix: change again to tryAgain
michaelbrusegard Sep 25, 2024
b46185a
fix: Add ARIA label to Combobox
ZeroWave022 Sep 25, 2024
05adccc
Merge remote-tracking branch 'origin/dev' into storage-shopping-cart
ZeroWave022 Sep 25, 2024
cf9d93b
Merge pull request #51 from hackerspace-ntnu/not-found
michaelbrusegard Sep 25, 2024
e5045af
feat: Add loan dialog, change location of back to storage button
ZeroWave022 Sep 26, 2024
4fe0e37
fix: Improve Shopping cart skeleton
ZeroWave022 Sep 26, 2024
8dab5de
fix: Improve storage page skeleton
ZeroWave022 Sep 26, 2024
ddb5cd8
Merge branch 'dev' into storage-shopping-cart
michaelbrusegard Sep 27, 2024
ea4532d
fix: shopping cart loading state
michaelbrusegard Sep 27, 2024
705d0f0
fix: add aria label to sort selector as indicated by lighthouse
michaelbrusegard Sep 27, 2024
f68c9b6
fix: remove usesearchparams, we use nuqs
michaelbrusegard Sep 27, 2024
028bece
feat: implemented a custom local storage hook
michaelbrusegard Sep 27, 2024
816453a
feat: create custom loader component
michaelbrusegard Sep 27, 2024
cac4f73
fix: client component translations
michaelbrusegard Sep 27, 2024
d388356
fix: item card suspense and semantic html
michaelbrusegard Sep 27, 2024
f699c5c
chore: move selectors to composites for reusability
michaelbrusegard Sep 27, 2024
2f9e177
fix: anchor tag inside of button or button inside of anchortag is ver…
michaelbrusegard Sep 27, 2024
d5d2b0a
fix: improve skeletons
michaelbrusegard Sep 27, 2024
44cfb86
feat: improved local storage hook masively
michaelbrusegard Sep 27, 2024
15e6e23
feat: simplified the form to use the calendar directly
michaelbrusegard Sep 27, 2024
19ff5de
fix: change to use object for localstorage
michaelbrusegard Sep 27, 2024
95405cd
fix: hydration errors
michaelbrusegard Sep 27, 2024
7a00edd
fix: small loading issues
michaelbrusegard Sep 27, 2024
7760b65
feat: add amount indicator to shopping cart
michaelbrusegard Sep 27, 2024
97c5196
fix: responsive design
michaelbrusegard Sep 27, 2024
e61223b
fix: Add SelectorsSkeleton back, as nuqs uses search params and they …
ZeroWave022 Sep 27, 2024
dfa81e5
feat: Auto-close ConfirmDialog on confirm
ZeroWave022 Sep 27, 2024
f81ed8e
fix: Make the Borrow Now button centered and responsive
ZeroWave022 Sep 27, 2024
d642455
fix: Make header and skeleton look better on small screens
ZeroWave022 Sep 27, 2024
b8f7272
build: Delete .husky/_ files, add gitignore
ZeroWave022 Sep 27, 2024
de5678c
refactor: Move husky gitignore
ZeroWave022 Sep 28, 2024
516db44
fix: Reduce size of shopping cart title on small screens
ZeroWave022 Sep 28, 2024
5c37a93
fix: Storage page header on smaller screens
ZeroWave022 Sep 28, 2024
3d523ef
fix: Header logo layout shift
ZeroWave022 Sep 28, 2024
48059eb
build: Restructure lhci config, ignore some rules for storage pages
ZeroWave022 Sep 28, 2024
b22b719
fix: lhci config
ZeroWave022 Sep 28, 2024
e21d821
build: Ignore max potential fid for storage pages
ZeroWave022 Sep 28, 2024
0efd907
Merge pull request #55 from hackerspace-ntnu/lighthouse-config
ZeroWave022 Sep 28, 2024
3cb5a0f
build: Connect Lighthouse CI to LHCI server
ZeroWave022 Sep 28, 2024
c841a1b
fix: Update LHCI version in the GH Action
ZeroWave022 Sep 28, 2024
5dedef0
fix: Fetch git info so we can have ancestor hash in LHCI
ZeroWave022 Sep 28, 2024
b74af5c
Merge pull request #54 from hackerspace-ntnu/husky-ignore
michaelbrusegard Sep 29, 2024
51c35db
Merge pull request #56 from hackerspace-ntnu/lhci-server-config
michaelbrusegard Sep 29, 2024
64ab8ea
Merge pull request #33 from hackerspace-ntnu/storage-shopping-cart
ZeroWave022 Oct 2, 2024
51aff17
fix: Do not lint button in combobox
ZeroWave022 Oct 6, 2024
405042b
fix: lighthouse storage regex
michaelbrusegard Oct 6, 2024
37768d1
fix: heading order
michaelbrusegard Oct 6, 2024
a1b37d4
fix: disable more rules
michaelbrusegard Oct 6, 2024
65e8a68
fix: assertion to match for all
michaelbrusegard Oct 6, 2024
b0d72da
fix: indent in lighthouse config
michaelbrusegard Oct 6, 2024
abae823
chore: set lighthouse rules specific
michaelbrusegard Oct 6, 2024
138437c
fix: set specific rules per page group
michaelbrusegard Oct 6, 2024
6aae695
refactor: Add margin to main
ZeroWave022 Oct 6, 2024
7dcbe35
fix: regex and try fixing linting
michaelbrusegard Oct 6, 2024
d5b60a3
Merge branch 'dev' into lighthouse-fixes
michaelbrusegard Oct 6, 2024
cc362ae
fix: gpt biome fix
michaelbrusegard Oct 6, 2024
4155b60
fix: lighthouse rules
michaelbrusegard Oct 6, 2024
211b026
Merge pull request #59 from hackerspace-ntnu/margin-main-content
ZeroWave022 Oct 6, 2024
aeeab6f
fix: martix pattern
michaelbrusegard Oct 6, 2024
1a638a7
fix: eslint error and simpler regex matching
michaelbrusegard Oct 6, 2024
805227e
chore: simplify lighthouse regex pattern
michaelbrusegard Oct 6, 2024
126f8d5
fix: regex
michaelbrusegard Oct 6, 2024
28ce5eb
chore: try more regex
michaelbrusegard Oct 6, 2024
665b665
chore: some fixes
michaelbrusegard Oct 12, 2024
1f74bf1
chore: set deployment and lhci to run on self hosted runners
michaelbrusegard Oct 13, 2024
9a387c2
chore: move assertions with special pattern to top
michaelbrusegard Oct 13, 2024
5a27be2
fix: stupid build errors
michaelbrusegard Oct 13, 2024
426b56b
ci: add node to lighthouse
michaelbrusegard Oct 13, 2024
bdf1192
ci: setup chrome
michaelbrusegard Oct 13, 2024
7e3b2d0
ci: chrome dependencies flag
michaelbrusegard Oct 13, 2024
b7f7ea4
fix: New regex for lhci
ZeroWave022 Oct 23, 2024
7106f02
fix: Revert to GH hosted runners
ZeroWave022 Oct 23, 2024
1f5073c
fix: Trailing slash for home page
ZeroWave022 Oct 23, 2024
8549a44
Merge pull request #58 from hackerspace-ntnu/lighthouse-fixes
michaelbrusegard Oct 24, 2024
236ed96
chore: rename fetch base red header
michaelbrusegard Oct 24, 2024
1fcfe5b
Merge branch 'main' into dev
michaelbrusegard Oct 24, 2024
cf7d669
Revert "Merge branch 'main' into dev"
michaelbrusegard Oct 24, 2024
53531d8
Reapply "Merge branch 'main' into dev"
michaelbrusegard Oct 24, 2024
612c43f
Revert "Reapply "Merge branch 'main' into dev""
michaelbrusegard Oct 24, 2024
c7d2433
Reapply "Reapply "Merge branch 'main' into dev""
michaelbrusegard Oct 24, 2024
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
7 changes: 6 additions & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ jobs:
FEIDE_TOKEN_ENDPOINT: "https://auth.dataporten.no/oauth/token"
FEIDE_USERINFO_ENDPOINT: "https://auth.dataporten.no/openid/userinfo"
NEXT_PUBLIC_SITE_URL: "http://localhost:3000"
LHCI_TOKEN: ${{ secrets.LHCI_BUILD_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 20
- name: Fetch base_ref HEAD
run: git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
Expand All @@ -54,5 +59,5 @@ jobs:
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
run: |
bun add -g @lhci/cli@0.13.x
bun add -g @lhci/cli@0.14.x
lhci autorun
2 changes: 1 addition & 1 deletion .github/workflows/deploy-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
jobs:
script:
name: Script
runs-on: ubuntu-latest
runs-on: self-hosted
environment: ${{ inputs.environment }}
steps:
- uses: appleboy/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ public/robots.txt

# data
/data

# Ignore husky files, see PR #54
/.husky/*
60 changes: 0 additions & 60 deletions .husky/_/pre-commit

This file was deleted.

60 changes: 0 additions & 60 deletions .husky/_/prepare-commit-msg

This file was deleted.

3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"useSemanticElements": "off"
},
"nursery": {
"useSortedClasses": {
"level": "warn",
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 0 additions & 2 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Use type safe message keys with `next-intl`
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
type Messages = typeof import('./messages/en.json');
// eslint-disable-next-line @typescript-eslint/no-empty-interface
declare interface IntlMessages extends Messages {}
2 changes: 1 addition & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pre-commit:
commands:
check:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
glob: "*.{js,ts,tsx,json}"
stage_fixed: true
run: bunx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
66 changes: 66 additions & 0 deletions lighthouserc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const PAGES_EXCLUDED = ['news', 'storage'];

// Do not convert into an ES6 export.
// lighthouse-ci (as of 0.14.0) uses require() to import, and this is not supported with ES6 modules.
module.exports = {
ci: {
collect: {
url: [
'http://localhost:3000/en/', // Trailing slash required, else the regex for default lighthouse rules won't catch this one
'http://localhost:3000/en/about',
'http://localhost:3000/en/events',
'http://localhost:3000/en/news',
'http://localhost:3000/en/news/1',
'http://localhost:3000/en/storage',
'http://localhost:3000/en/storage/shopping-cart',
],
startServerCommand: 'bun run start',
},
upload: {
target: 'lhci',
serverBaseUrl: 'https://lhci.hackerspace-ntnu.no', // build token is set by the GH Action
},
assert: {
assertMatrix: [
{
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
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
},
},
{
matchingUrlPattern: 'http://.*/en/news.*',
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
interactive: 'off',
'uses-responsive-images': 'off', // Should be removed when we obtain images from backend
},
},
{
matchingUrlPattern: 'http://.*/en/storage.*',
preset: 'lighthouse:recommended',
assertions: {
'bf-cache': 'off',
'color-contrast': 'off',
'heading-order': 'off',
'largest-contentful-paint': 'off',
'render-blocking-resources': 'off',
'unused-javascript': 'off',
'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
'max-potential-fid': 'off',
},
},
],
},
},
};
37 changes: 0 additions & 37 deletions lighthouserc.yml

This file was deleted.

54 changes: 51 additions & 3 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
"next": "Next",
"goToNextPage": "Go to next page",
"morePages": "More pages",
"page": "page"
"page": "page",
"category": "category",
"sort": "sort",
"photoOf": "Photo of {name}"
},
"error": {
"notFound": "404 - Page not found",
"notFoundDescription": "Oops! Looks like this page got lost in cyberspace.",
"error": "Oops! Something went wrong",
"errorDescription": "Don't worry, our best hackers are on it!",
"goToHomepage": "Return to homepage",
"tryAgain": "Try again"
},
"layout": {
"hackerspaceHome": "Hackerspace homepage",
Expand Down Expand Up @@ -52,13 +63,15 @@
},
"storage": {
"title": "Storage",
"searchPlaceholder": "Search for product...",
"card": {
"quantityInfo": "{quantity} units",
"addToCart": "Add to cart"
"addToCart": "Add to cart",
"removeFromCart": "Remove from cart"
},
"select": {
"ariaLabel": "Select how to filter the storage items",
"filters": "Filters",
"defaultPlaceholder": "Sort results",
"popularity": "Popularity",
"sortDescending": "Inventory (descending)",
"sortAscending": "Inventory (ascending)",
Expand All @@ -72,8 +85,43 @@
"peripherals": "PC peripherals",
"miniPC": "Mini PC"
},
"searchParams": {
"popularity": "popularity",
"descending": "descending",
"ascending": "ascending",
"name": "name",
"cables": "cables",
"sensors": "sensors",
"peripherals": "peripherals",
"miniPC": "minipc"
},
"tooltips": {
"viewShoppingCart": "View shopping cart"
},
"shoppingCart": {
"title": "Shopping Cart",
"productId": "Product ID",
"productName": "Product Name",
"location": "Location",
"unitsAvailable": "Units available",
"tableDescription": "A list of your shopping cart items.",
"backToStorage": "Back to storage",
"cartEmpty": "Your shopping cart is empty.",
"clearCart": "Empty shopping cart",
"cancel": "Cancel",
"clear": "Clear",
"clearCartDescription": "Are you sure you want to clear your shopping cart? All items will be removed.",
"borrowNow": "Borrow now",
"amountOfItemARIA": "Select number of this item"
},
"loanForm": {
"name": "Name",
"email": "Email",
"phoneNumber": "Phone number",
"phoneNumberDescription": "Phone number for contact. Include country code if the number isn't Norwegian.",
"returnBy": "Return by",
"returnByDescription": "Select how long you would like to borrow the item for.",
"submit": "Submit"
}
}
}
Loading