Edit profile dialog ALF refresh (#5633)

This commit is contained in:
Samuel Newman
2024-10-15 21:57:28 +03:00
committed by GitHub
parent fe5eb507ca
commit c3d0cc55d9
16 changed files with 567 additions and 405 deletions
+14
View File
@@ -41,6 +41,20 @@ export function useEnforceMaxGraphemeCount() {
)
}
export function useWarnMaxGraphemeCount({
text,
maxCount,
}: {
text: string
maxCount: number
}) {
const splitter = useMemo(() => new Graphemer(), [])
return useMemo(() => {
return splitter.countGraphemes(text) > maxCount
}, [splitter, maxCount, text])
}
// https://stackoverflow.com/a/52171480
export function toHashCode(str: string, seed = 0): number {
let h1 = 0xdeadbeef ^ seed,