Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"eslint-plugin-jest": "^29.0.0",
"eslint-plugin-mdx": "^3.0.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-hooks": "^7.0.0",
"eslint-plugin-storybook": "9.1.13",
"eslint-plugin-styled-components-a11y": "^2.1.35",
"eslint-plugin-testing-library": "^7.0.0",
Expand Down
8 changes: 5 additions & 3 deletions src/bundles/AiDrawer/FlashcardsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ const Flashcard = React.forwardRef<HTMLButtonElement, { content: Flashcard }>(
({ content, ...others }, ref) => {
const [screen, setScreen] = useState<0 | 1>(0)

useEffect(() => setScreen(0), [content])

const handleClick = () => {
setScreen((current) => (current === 0 ? 1 : 0))
}
Expand Down Expand Up @@ -126,7 +124,11 @@ export const FlashcardsScreen = ({
role="region"
aria-label={`Flashcard ${cardIndex + 1} of ${flashcards.length}`}
>
<Flashcard ref={flashcardRef} content={flashcards[cardIndex]} />
<Flashcard
key={`flashcard-${cardIndex}`}
ref={flashcardRef}
content={flashcards[cardIndex]}
/>
</div>
<Navigation>
<ActionButton
Expand Down
29 changes: 15 additions & 14 deletions src/components/AiChat/AiChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,25 @@ const AiChatDisplay: FC<AiChatDisplayProps> = ({
setAdditionalBody,
} = useAiChat()

const [messagesContainerElement, setMessagesContainerElement] =
useState<HTMLDivElement | null>(null)

useEffect(() => {
setMessagesContainerElement(messagesContainerRef.current)
}, [])

useScrollSnap({
scrollElement: scrollElement || messagesContainerRef.current,
contentElement: scrollElement ? messagesContainerRef.current : null,
scrollElement: scrollElement || messagesContainerElement,
contentElement: scrollElement ? messagesContainerElement : null,
threshold: 200,
})

const [showEntryScreen, setShowEntryScreen] = useState(entryScreenEnabled)
const showEntryScreen =
entryScreenEnabled &&
!messages.some(
(m) => m.role === "user" || ["submitted", "streaming"].includes(status),
)

useEffect(() => {
if (!showEntryScreen) {
promptInputRef.current
Expand Down Expand Up @@ -417,16 +429,6 @@ const AiChatDisplay: FC<AiChatDisplayProps> = ({
}
}, [problemSetListResponse, problemSetEmptyMessages, setMessages])

useEffect(() => {
if (
messages.some(
(m) => m.role === "user" || ["submitted", "streaming"].includes(status),
)
) {
setShowEntryScreen(false)
}
}, [messages, status])

const showStarters = messages.length === (initialMessages?.length || 0)

const waiting =
Expand Down Expand Up @@ -473,7 +475,6 @@ const AiChatDisplay: FC<AiChatDisplayProps> = ({
if (prompt.trim() === "") {
return
}
setShowEntryScreen(false)
append({ role: "user", content: prompt })
onSubmit?.(prompt, meta)
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SrAnnouncer/SrAnnouncer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const SrAnnouncer: React.FC<SrAnnouncerProps> = ({
"SrAnnouncer: loadingMessages changed (by ===) unexpectedly. This may interfere with loading message visibility",
)

useEffect(() => {
React.useLayoutEffect(() => {
setLoadingMsgIndex(-1)
}, [isLoading, loadingMessages])

Expand Down
70 changes: 61 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,17 @@ __metadata:
languageName: node
linkType: hard

"@babel/parser@npm:^7.24.4":
version: 7.28.4
resolution: "@babel/parser@npm:7.28.4"
dependencies:
"@babel/types": "npm:^7.28.4"
bin:
parser: ./bin/babel-parser.js
checksum: 10/f54c46213ef180b149f6a17ea765bf40acc1aebe2009f594e2a283aec69a190c6dda1fdf24c61a258dbeb903abb8ffb7a28f1a378f8ab5d333846ce7b7e23bf1
languageName: node
linkType: hard

"@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.27.1":
version: 7.27.1
resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.27.1"
Expand Down Expand Up @@ -1505,6 +1516,16 @@ __metadata:
languageName: node
linkType: hard

"@babel/types@npm:^7.28.4":
version: 7.28.4
resolution: "@babel/types@npm:7.28.4"
dependencies:
"@babel/helper-string-parser": "npm:^7.27.1"
"@babel/helper-validator-identifier": "npm:^7.27.1"
checksum: 10/db50bf257aafa5d845ad16dae0587f57d596e4be4cbb233ea539976a4c461f9fbcc0bf3d37adae3f8ce5dcb4001462aa608f3558161258b585f6ce6ce21a2e45
languageName: node
linkType: hard

"@bcoe/v8-coverage@npm:^0.2.3":
version: 0.2.3
resolution: "@bcoe/v8-coverage@npm:0.2.3"
Expand Down Expand Up @@ -2808,7 +2829,7 @@ __metadata:
eslint-plugin-jest: "npm:^29.0.0"
eslint-plugin-mdx: "npm:^3.0.0"
eslint-plugin-react: "npm:^7.34.3"
eslint-plugin-react-hooks: "npm:^5.0.0"
eslint-plugin-react-hooks: "npm:^7.0.0"
eslint-plugin-storybook: "npm:9.1.13"
eslint-plugin-styled-components-a11y: "npm:^2.1.35"
eslint-plugin-testing-library: "npm:^7.0.0"
Expand Down Expand Up @@ -8542,12 +8563,18 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-react-hooks@npm:^5.0.0":
version: 5.2.0
resolution: "eslint-plugin-react-hooks@npm:5.2.0"
"eslint-plugin-react-hooks@npm:^7.0.0":
version: 7.0.0
resolution: "eslint-plugin-react-hooks@npm:7.0.0"
dependencies:
"@babel/core": "npm:^7.24.4"
"@babel/parser": "npm:^7.24.4"
hermes-parser: "npm:^0.25.1"
zod: "npm:^3.22.4 || ^4.0.0"
zod-validation-error: "npm:^3.0.3 || ^4.0.0"
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
checksum: 10/ebb79e9cf69ae06e3a7876536653c5e556b5fd8cd9dc49577f10a6e728360e7b6f5ce91f4339b33e93b26e3bb23805418f8b5e75db80baddd617b1dffe73bed1
checksum: 10/756ad90ec6390bafa8037f86ab72d98af55c25e13b69e15bdac634724c8af7a87eb6993b643665e930d67635d52c8aa55b0e7a1d47e3c4e42a3b66950b2069fb
languageName: node
linkType: hard

Expand Down Expand Up @@ -9853,6 +9880,22 @@ __metadata:
languageName: node
linkType: hard

"hermes-estree@npm:0.25.1":
version: 0.25.1
resolution: "hermes-estree@npm:0.25.1"
checksum: 10/7b1eca98b264a25632064cffa5771360d30cf452e77db1e191f9913ee45cf78c292b2dbca707e92fb71b0870abb97e94b506a5ab80abd96ba237fee169b601fe
languageName: node
linkType: hard

"hermes-parser@npm:^0.25.1":
version: 0.25.1
resolution: "hermes-parser@npm:0.25.1"
dependencies:
hermes-estree: "npm:0.25.1"
checksum: 10/805efc05691420f236654349872c70731121791fa54de521c7ee51059eae34f84dd19f22ee846741dcb60372f8fb5335719b96b4ecb010d2aed7d872f2eff9cc
languageName: node
linkType: hard

"highlight.js@npm:^10.7.1":
version: 10.7.3
resolution: "highlight.js@npm:10.7.3"
Expand Down Expand Up @@ -17664,8 +17707,8 @@ __metadata:
linkType: hard

"vite@npm:^7.0.0":
version: 7.1.11
resolution: "vite@npm:7.1.11"
version: 7.1.5
resolution: "vite@npm:7.1.5"
dependencies:
esbuild: "npm:^0.25.0"
fdir: "npm:^6.5.0"
Expand Down Expand Up @@ -17714,7 +17757,7 @@ __metadata:
optional: true
bin:
vite: bin/vite.js
checksum: 10/b75ce7a38beeba7800751938df4fe2638cfb77509647329ac824332af51831eaed52ab0a0bae1d9162ac41ef59fff1c754e0acf7e1470dfa7d3da51fc3bf0985
checksum: 10/59edeef7e98757a668b2ad8a1731a5657fa83e22a165a36b7359225ea98a9be39b2f486710c0cf5085edb85daee7c8b6b6b0bd85d0ef32a1aa84aef71aabd0f0
languageName: node
linkType: hard

Expand Down Expand Up @@ -18224,7 +18267,16 @@ __metadata:
languageName: node
linkType: hard

"zod@npm:^4.0.0":
"zod-validation-error@npm:^3.0.3 || ^4.0.0":
version: 4.0.2
resolution: "zod-validation-error@npm:4.0.2"
peerDependencies:
zod: ^3.25.0 || ^4.0.0
checksum: 10/5e35ca8ebb4602dcb526e122d7e9fca695c4a479bd97535f3400a732d49160f24f7213a9ed64986fc9dc3a2e8a6c4e1241ec0c4d8a4e3e69ea91a0328ded2192
languageName: node
linkType: hard

"zod@npm:^3.22.4 || ^4.0.0, zod@npm:^4.0.0":
version: 4.1.12
resolution: "zod@npm:4.1.12"
checksum: 10/c5f04e6ac306515c4db6ef73cf7705f521c7a2107c8c8912416a0658d689f361db9bee829b0bf01ef4a22492f1065c5cbcdb523ce532606ac6792fd714f3c326
Expand Down