forked from deepgram-starters/nextjs-live-transcription
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: options stored in memory, responsiveness, input (#31)
* fix: LCP of app Relates to #29 * fix: accessibility * fix: LCP, performance increase from 50 to 70% * fix: Fix mobile responsive, store voice * fix: layout to avoid duplication of MessageAudio * fix: build failed because of types * fix: border to 2rem
- Loading branch information
1 parent
89e5f51
commit 7e26d79
Showing
15 changed files
with
154 additions
and
92 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
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,24 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
export const useLocalStorage = <T>( | ||
key: string, | ||
initialValue: T | ||
): [T, (value: T) => void] => { | ||
const [storedValue, setStoredValue] = useState(initialValue) | ||
|
||
useEffect(() => { | ||
// Retrieve from localStorage | ||
const item = window.localStorage.getItem(key) | ||
if (item) { | ||
setStoredValue(JSON.parse(item)) | ||
} | ||
}, [key]) | ||
|
||
const setValue = (value: T) => { | ||
// Save state | ||
setStoredValue(value) | ||
// Save to localStorage | ||
window.localStorage.setItem(key, JSON.stringify(value)) | ||
} | ||
return [storedValue, setValue] | ||
} |
Oops, something went wrong.