-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfe6244
commit 7c0578d
Showing
228 changed files
with
10,555 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// https://github.com/bvaughn/react-error-boundary/issues/182 | ||
'use client' | ||
|
||
export * from 'react-error-boundary' | ||
export { ErrorBoundary } from 'react-error-boundary' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
package-lock.json | ||
built_node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"bracketSameLine": false, | ||
"bracketSpacing": true, | ||
"embeddedLanguageFormatting": "auto", | ||
"endOfLine": "lf", | ||
"htmlWhitespaceSensitivity": "css", | ||
"insertPragma": false, | ||
"jsxSingleQuote": false, | ||
"printWidth": 80, | ||
"proseWrap": "always", | ||
"quoteProps": "as-needed", | ||
"requirePragma": false, | ||
"semi": false, | ||
"singleAttributePerLine": false, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"useTabs": true, | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.json"], | ||
"options": { | ||
"useTabs": false | ||
} | ||
}, | ||
{ | ||
"files": ["**/*.mdx"], | ||
"options": { | ||
"proseWrap": "preserve", | ||
"htmlWhitespaceSensitivity": "ignore" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Client Router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import fs from 'node:fs/promises' | ||
|
||
const shipData = JSON.parse( | ||
String(await fs.readFile(new URL('./ships.json', import.meta.url))), | ||
) | ||
|
||
const MIN_DELAY = 200 | ||
const MAX_DELAY = 500 | ||
|
||
export async function searchShips({ | ||
search, | ||
delay = Math.random() * (MAX_DELAY - MIN_DELAY) + MIN_DELAY, | ||
}) { | ||
const endTime = Date.now() + delay | ||
const ships = shipData | ||
.filter(ship => ship.name.toLowerCase().includes(search.toLowerCase())) | ||
.slice(0, 13) | ||
await new Promise(resolve => setTimeout(resolve, endTime - Date.now())) | ||
return { | ||
ships: ships.map(ship => ({ name: ship.name, id: ship.id })), | ||
} | ||
} | ||
|
||
export async function getShip({ | ||
shipId, | ||
delay = Math.random() * (MAX_DELAY - MIN_DELAY) + MIN_DELAY, | ||
}) { | ||
const endTime = Date.now() + delay | ||
if (!shipId) { | ||
throw new Error('No shipId provided') | ||
} | ||
const ship = shipData.find(ship => ship.id === shipId) | ||
await new Promise(resolve => setTimeout(resolve, endTime - Date.now())) | ||
if (!ship) { | ||
throw new Error(`No ship with the id "${shipId}"`) | ||
} | ||
return ship | ||
} | ||
|
||
export async function updateShipName({ | ||
shipId, | ||
shipName, | ||
delay = Math.random() * (MAX_DELAY - MIN_DELAY) + MIN_DELAY, | ||
}) { | ||
const endTime = Date.now() + delay | ||
const ship = shipData.find(ship => ship.id === shipId) | ||
await new Promise(resolve => setTimeout(resolve, endTime - Date.now())) | ||
if (!ship) { | ||
throw new Error(`No ship with the id "${shipId}"`) | ||
} | ||
if (shipName.toLowerCase().includes('error')) { | ||
throw new Error('Error updating ship name') | ||
} | ||
if (shipName === ship.name) { | ||
throw new Error('New name is the same as the old name') | ||
} | ||
ship.name = shipName | ||
return ship | ||
} |
Oops, something went wrong.