chore: 🎨 format

This commit is contained in:
ThatOneCalculator 2023-04-01 21:10:31 -07:00
parent 2469198bb1
commit e9b45260b5
No known key found for this signature in database
GPG key ID: 8703CACD01000000
8 changed files with 25 additions and 18 deletions

View file

@ -266,10 +266,8 @@ export const NoteRepository = db.getRepository(Note).extend({
if (packed.user.isCat && packed.text) { if (packed.user.isCat && packed.text) {
const tokens = packed.text ? mfm.parse(packed.text) : []; const tokens = packed.text ? mfm.parse(packed.text) : [];
function nyaizeNode(node: mfm.MfmNode) { function nyaizeNode(node: mfm.MfmNode) {
if (node.type === "quote") if (node.type === "quote") return;
return; if (node.type === "text") node.props.text = nyaize(node.props.text);
if (node.type === "text")
node.props.text = nyaize(node.props.text);
if (node.children) { if (node.children) {
for (const child of node.children) { for (const child of node.children) {
@ -278,8 +276,7 @@ export const NoteRepository = db.getRepository(Note).extend({
} }
} }
for (const node of tokens) for (const node of tokens) nyaizeNode(node);
nyaizeNode(node);
packed.text = mfm.toString(tokens); packed.text = mfm.toString(tokens);
} }

View file

@ -57,8 +57,7 @@ export default class extends Channel {
// Remove not typing users // Remove not typing users
for (const [userId, date] of Object.entries(this.typers)) { for (const [userId, date] of Object.entries(this.typers)) {
if (now.getTime() - date.getTime() > 5000) if (now.getTime() - date.getTime() > 5000) this.typers.delete(userId);
this.typers.delete(userId);
} }
const userIds = Array.from(this.typers.keys()); const userIds = Array.from(this.typers.keys());

View file

@ -108,8 +108,7 @@ export default class extends Channel {
// Remove not typing users // Remove not typing users
for (const [userId, date] of this.typers.entries()) { for (const [userId, date] of this.typers.entries()) {
if (now.getTime() - date.getTime() > 5000) if (now.getTime() - date.getTime() > 5000) this.typers.delete(userId);
this.typers.delete(userId);
} }
const userIds = Array.from(this.typers.keys()); const userIds = Array.from(this.typers.keys());

View file

@ -47,10 +47,10 @@ window.onload = async () => {
const el = document.createElement("div"); const el = document.createElement("div");
const header = document.createElement("header"); const header = document.createElement("header");
const name = document.createElement("p"); const name = document.createElement("p");
const avatar = document.createElement("img") const avatar = document.createElement("img");
name.textContent = `${note.user.name} @${note.user.username}`; name.textContent = `${note.user.name} @${note.user.username}`;
avatar.src = note.user.avatarUrl; avatar.src = note.user.avatarUrl;
avatar.style = 'height: 40px' avatar.style = "height: 40px";
const text = document.createElement("div"); const text = document.createElement("div");
text.textContent = `${note.text}`; text.textContent = `${note.text}`;
el.appendChild(header); el.appendChild(header);
@ -63,7 +63,7 @@ window.onload = async () => {
for (const file of note.files) { for (const file of note.files) {
const img = document.createElement("img"); const img = document.createElement("img");
img.src = file.properties.thumbnailUrl; img.src = file.properties.thumbnailUrl;
el.appendChild(img) el.appendChild(img);
} }
} }
tl.appendChild(el); tl.appendChild(el);

View file

@ -556,7 +556,11 @@ export default abstract class Chart<T extends Schema> {
// bake unique count // bake unique count
for (const [k, v] of Object.entries(finalDiffs)) { for (const [k, v] of Object.entries(finalDiffs)) {
if (this.schema[k].uniqueIncrement && Array.isArray(v) && v.length > 0) { if (
this.schema[k].uniqueIncrement &&
Array.isArray(v) &&
v.length > 0
) {
const name = (columnPrefix + const name = (columnPrefix +
k.replaceAll(".", columnDot)) as keyof Columns<T>; k.replaceAll(".", columnDot)) as keyof Columns<T>;
const tempColumnName = (uniqueTempColumnPrefix + const tempColumnName = (uniqueTempColumnPrefix +
@ -660,7 +664,7 @@ export default abstract class Chart<T extends Schema> {
const startTime = Date.now(); const startTime = Date.now();
await Promise.all( await Promise.all(
groups.map((group) => groups.map((group) =>
limit(() => limit(() =>
Promise.all([ Promise.all([
this.claimCurrentLog(group, "hour"), this.claimCurrentLog(group, "hour"),

View file

@ -67,6 +67,6 @@ export function openHelpMenu_(ev: MouseEvent) {
], ],
}, },
], ],
ev.currentTarget ?? ev.target ev.currentTarget ?? ev.target,
); );
} }

View file

@ -30,7 +30,8 @@ export function play(type: string) {
export function playFile(file: string, volume: number) { export function playFile(file: string, volume: number) {
const masterVolume = ColdDeviceStorage.get("sound_masterVolume"); const masterVolume = ColdDeviceStorage.get("sound_masterVolume");
if (masterVolume === 0 || volume === 0 || file.toLowerCase().includes("none")) return; if (masterVolume === 0 || volume === 0 || file.toLowerCase().includes("none"))
return;
const audio = setVolume(getAudio(file), volume); const audio = setVolume(getAudio(file), volume);
audio.play(); audio.play();

View file

@ -90,7 +90,14 @@ type OuterMenuItem =
| MenuButtonMultipleIcons | MenuButtonMultipleIcons
| MenuParent; | MenuParent;
type OuterPromiseMenuItem = Promise< type OuterPromiseMenuItem = Promise<
MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuButtonMultipleIcons | MenuParent | MenuLabel
| MenuLink
| MenuA
| MenuUser
| MenuSwitch
| MenuButton
| MenuButtonMultipleIcons
| MenuParent
>; >;
export type MenuItem = OuterMenuItem | OuterPromiseMenuItem; export type MenuItem = OuterMenuItem | OuterPromiseMenuItem;
export type InnerMenuItem = export type InnerMenuItem =