-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add view source feature, add gloss for brandt 03-1
- Loading branch information
1 parent
7131abb
commit 9c02cda
Showing
17 changed files
with
770 additions
and
497 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export type Result<T> = | ||
| { | ||
ok: true; | ||
value: T; | ||
} | ||
| { | ||
ok: false; | ||
error: any; | ||
message: string; | ||
}; | ||
|
||
export const success = <T>(value: T): Result<T> => ({ | ||
ok: true, | ||
value, | ||
}); | ||
|
||
export const failure = (error: any): Result<never> => ({ | ||
ok: false, | ||
error, | ||
get message() { | ||
return error instanceof Error ? error.message : String(error); | ||
}, | ||
}); | ||
|
||
export const attempt = <T>(fn: () => T): Result<T> => { | ||
try { | ||
return success(fn()); | ||
} catch (error) { | ||
return failure(error); | ||
} | ||
}; |
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,27 @@ | ||
"use client"; | ||
import { PassageVocab } from "../Passage"; | ||
import { ChineseWithPopover, DisplayOptions } from "./ChineseWithPopover"; | ||
import { GlossDocument } from "@/app/glossUtils"; | ||
|
||
export function NotesChinese({ | ||
children, | ||
vocab, | ||
displayOptions, | ||
gloss, | ||
}: { | ||
children: string; | ||
vocab: PassageVocab; | ||
displayOptions: DisplayOptions; | ||
gloss: GlossDocument | null; | ||
}) { | ||
return ( | ||
<span className="text-3xl"> | ||
<ChineseWithPopover | ||
text={children} | ||
vocab={vocab} | ||
displayOptions={displayOptions} | ||
gloss={gloss} | ||
/> | ||
</span> | ||
); | ||
} |
Oops, something went wrong.