Abide by 80col limit

This commit is contained in:
0x1eef 2023-10-28 12:11:45 -03:00
parent b1d9be9806
commit 479106b13a
9 changed files with 34 additions and 13 deletions

View file

@ -3,8 +3,8 @@
pattern=".ts|.tsx|.js$" pattern=".ts|.tsx|.js$"
files=$(git --no-pager diff --cached --name-only | grep -E -e "${pattern}") files=$(git --no-pager diff --cached --name-only | grep -E -e "${pattern}")
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
npm run prettier -- "${files}" || exit 1 npm run prettier -- -c ${files} || exit 1
npm run eslint -- "${files}" || exit 1 npm run eslint -- ${files} || exit 1
git add "${files}" git add "${files}"
exit 0 exit 0
else else

View file

@ -3,6 +3,6 @@
"tabWidth": 2, "tabWidth": 2,
"semi": true, "semi": true,
"singleQuote": false, "singleQuote": false,
"printWidth": 90, "printWidth": 80,
"arrowParens": "avoid" "arrowParens": "avoid"
} }

View file

@ -44,7 +44,9 @@ export function AudioControl({
useEffect(() => { useEffect(() => {
if (soundOn) { if (soundOn) {
audio.src = [url.format(recitation.url), surah.id, `${ayah.id}.mp3`].join("/"); audio.src = [url.format(recitation.url), surah.id, `${ayah.id}.mp3`].join(
"/",
);
audio.play(); audio.play();
} else { } else {
audio.pause(); audio.pause();

View file

@ -40,7 +40,8 @@ export function Stream({
)} )}
<span> <span>
{t(locale, "surah")} {formatNumber(surah.id, locale)} {t(locale, "surah")} {formatNumber(surah.id, locale)}
{t(locale, "comma")} {t(locale, "ayah")} {formatNumber(ayah.id, locale)} {t(locale, "comma")} {t(locale, "ayah")}{" "}
{formatNumber(ayah.id, locale)}
</span> </span>
</span> </span>
<p>{ayah.text}</p> <p>{ayah.text}</p>

View file

@ -53,7 +53,9 @@ export function Timer({
return ( return (
<div className="timer"> <div className="timer">
{ms / 1000 <= 0 ? formatNumber(0, locale) : formatNumber(ms / 1000, locale)} {ms / 1000 <= 0
? formatNumber(0, locale)
: formatNumber(ms / 1000, locale)}
</div> </div>
); );
} }

View file

@ -23,6 +23,8 @@ import postman, { item } from "postman";
parent.remove(); parent.remove();
pkg.fonts.forEach(f => document.fonts.add(f)); pkg.fonts.forEach(f => document.fonts.add(f));
pkg.css.forEach(s => document.head.appendChild(s)); pkg.css.forEach(s => document.head.appendChild(s));
pkg.scripts.forEach(s => document.body.removeChild(document.body.appendChild(s))); pkg.scripts.forEach(s =>
document.body.removeChild(document.body.appendChild(s)),
);
}); });
})(); })();

View file

@ -7,7 +7,8 @@ import * as Quran from "lib/Quran";
const progressBar: HTMLProgressElement = parent.querySelector("progress")!; const progressBar: HTMLProgressElement = parent.querySelector("progress")!;
const progressNumber: HTMLSpanElement = parent.querySelector(".percentage")!; const progressNumber: HTMLSpanElement = parent.querySelector(".percentage")!;
const inlineStyle: HTMLStyleElement = document.querySelector(".css.postman")!; const inlineStyle: HTMLStyleElement = document.querySelector(".css.postman")!;
const { locale, surahId } = document.querySelector<HTMLElement>(".root")!.dataset; const { locale, surahId } =
document.querySelector<HTMLElement>(".root")!.dataset;
const recitations = JSON.parse( const recitations = JSON.parse(
document.querySelector<HTMLElement>(".json.recitations")!.innerText, document.querySelector<HTMLElement>(".json.recitations")!.innerText,
); );
@ -19,7 +20,11 @@ import * as Quran from "lib/Quran";
item.font("Amiri Quran Regular", "url(/fonts/amiri-quran-regular.ttf"), item.font("Amiri Quran Regular", "url(/fonts/amiri-quran-regular.ttf"),
item.json(`/${locale}/${surahId}/surah.json`, { className: "surah" }), item.json(`/${locale}/${surahId}/surah.json`, { className: "surah" }),
...recitations.map((recitation: Quran.Recitation) => { ...recitations.map((recitation: Quran.Recitation) => {
const ts = [url.format(recitation.url), "time_slots", `${surahId}.json`].join("/"); const ts = [
url.format(recitation.url),
"time_slots",
`${surahId}.json`,
].join("/");
return item.json(ts, { return item.json(ts, {
className: `recitation time-slots ${recitation.id}`, className: `recitation time-slots ${recitation.id}`,
}); });
@ -36,6 +41,8 @@ import * as Quran from "lib/Quran";
pkg.fonts.forEach(f => document.fonts.add(f)); pkg.fonts.forEach(f => document.fonts.add(f));
pkg.css.forEach(s => document.head.appendChild(s)); pkg.css.forEach(s => document.head.appendChild(s));
pkg.json.forEach(o => document.body.appendChild(o)); pkg.json.forEach(o => document.body.appendChild(o));
pkg.scripts.forEach(s => document.body.removeChild(document.body.appendChild(s))); pkg.scripts.forEach(s =>
document.body.removeChild(document.body.appendChild(s)),
);
}); });
})(); })();

View file

@ -27,7 +27,10 @@ function SurahIndex({ locale, surahs, t }: Props) {
}, [ref.current, theme]); }, [ref.current, theme]);
return ( return (
<div ref={ref} className={classNames("invisible", "content", "theme", theme, locale)}> <div
ref={ref}
className={classNames("invisible", "content", "theme", theme, locale)}
>
<header> <header>
<h1> <h1>
<a href={`/${locale}/`}>{t(locale, "TheNobleQuran")}</a> <a href={`/${locale}/`}>{t(locale, "TheNobleQuran")}</a>
@ -74,5 +77,7 @@ function SurahIndex({ locale, surahs, t }: Props) {
}, },
); );
ReactDOM.createRoot(root).render(<SurahIndex locale={locale} surahs={surahs} t={t} />); ReactDOM.createRoot(root).render(
<SurahIndex locale={locale} surahs={surahs} t={t} />,
);
})(); })();

View file

@ -122,7 +122,9 @@ function SurahStream({ node, recitations, locale, paused, t }: Props) {
isStalled={isStalled} isStalled={isStalled}
/> />
)} )}
{readyToRender && endOfStream && <RefreshIcon onClick={() => setStream([])} />} {readyToRender && endOfStream && (
<RefreshIcon onClick={() => setStream([])} />
)}
<div className="br" /> <div className="br" />
{readyToRender && soundOn && isStalled && <StalledIcon />} {readyToRender && soundOn && isStalled && <StalledIcon />}
</footer> </footer>