Skip to content

Commit

Permalink
fix(jukebox): assorted fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blueset committed Nov 5, 2023
1 parent c9c2fbb commit 8a7342a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ function furiganaHighlight(
const primaryText = { color: theme.palette.primary.light };
const secondaryText = { color: theme.palette.secondary.light };
return (base, ruby, groupings) => {
if (base === "明日" && (ruby === "あした" || ruby === "あす"))
return secondaryText;
if (base === "抱" && (ruby === "だ" || ruby === "いだ"))
if (
(base === "明日" && (ruby === "あした" || ruby === "あす")) ||
(base === "抱" && (ruby === "だ" || ruby === "いだ")) ||
(base === "行" && (ruby === "い" || ruby === "ゆ")) ||
(base === "金" && ruby === "きん")
)
return secondaryText;
if (base === "行" && (ruby === "い" || ruby === "ゆ")) return secondaryText;
if (base === "今" && ruby === "こん") return primaryText;
if (base === "君" && ruby === "くん") return primaryText;
if (
(base === "今" && ruby === "こん") ||
(base === "君" && ruby === "くん") ||
(base === "歪" && ruby === "いが")
)
return primaryText;

// contextual
if (
Expand Down Expand Up @@ -122,6 +128,7 @@ export default function EditFurigana({ lyrics, setLyrics, fileId }: Props) {
}>({
query: KARAOKE_TRANSLITERATION_QUERY,
variables: { text: lines.map((v) => v.content).join("\n") },
fetchPolicy: "network-only",
});
if (result.data) {
// Copy `lines` for React to recognize it as a new state
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FURIGANA, LyricsLine, RangeAttributeLabel } from "lyrics-kit/core";

const pattern =
"(([あいうえおアイウエオゕゖヵヶてでテデんン]|[かがさざただなはばぱまやらわカガサザタダナハバパマヤラワヷ][あア]*|[きぎしじちぢにひびぴみりゐキギシジチヂニヒビピミリヰヸ]([ゃャ]|[ゅょュョ][うウ]?)*|[くぐすずつづぬふぶぷむゆるゔクグスズツヅヌフブプムユルヴ][うウ]*|[けげせぜねへべぺめれゑケゲセゼネヘベペメレヱヹ][いイ]*|[こごそぞとどのほぼぽもよろをコゴソゾトドノホボポモヨロヲヺ][うウ]*)[ぁぃぅぇぉっァィゥェォッーんン]*|\\p{sc=Han}|[\\p{sc=Latin}\\p{sc=Cyrillic}\\p{sc=Greek}\\p{Nd}]+)";
"(([あいうえおアイウエオゕゖヵヶてでテデんン]|[きぎしじちぢにひびぴみりゐキギシジチヂニヒビピミリヰヸ]([ゃャ]|[ゅょュョ][うウ]?)*|[くぐすずつづぬふぶぷむゆるゔクグスズツヅヌフブプムユルヴ][うウ]*|[けげせぜねへべぺめれゑケゲセゼネヘベペメレヱヹ][いイ]*|[こごそぞとどのほぼぽもよろをコゴソゾトドノホボポモヨロヲヺ][うウ]*)[ぁぃぅぇぉっァィゥェォッーんン]*|\\p{sc=Han}|[\\p{sc=Latin}\\p{sc=Cyrillic}\\p{sc=Greek}\\p{Nd}]+)";
const beginPattern = new RegExp(pattern, "u");
const countPattern = new RegExp(pattern, "gu");

Expand Down

0 comments on commit 8a7342a

Please sign in to comment.