upd: remove quote button restriction and coloring

This commit is contained in:
Mar0xy 2023-11-29 22:26:10 +01:00
parent 264062258b
commit 363bb43658
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
3 changed files with 3 additions and 96 deletions

View file

@ -127,9 +127,8 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="quoteButton"
:class="$style.footerButton"
class="_button"
:style="quoted ? 'color: var(--accent) !important;' : ''"
v-on:click.stop
@mousedown="quoted ? undoQuote(appearNote) : quote()"
@mousedown="quote()"
>
<i class="ph-quotes ph-bold ph-lg"></i>
</button>
@ -281,7 +280,6 @@ const isLong = shouldCollapsed(appearNote, urls ?? []);
const collapsed = ref(appearNote.cw == null && isLong);
const isDeleted = ref(false);
const renoted = ref(false);
const quoted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
const translation = ref<any>(null);
const translating = ref(false);
@ -367,15 +365,6 @@ if (!props.mock) {
}).then((res) => {
renoted.value = res.length > 0;
});
os.api("notes/renotes", {
noteId: appearNote.id,
userId: $i.id,
limit: 1,
quote: true,
}).then((res) => {
quoted.value = res.length > 0;
});
}
}
@ -470,7 +459,6 @@ function quote() {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
quoted.value = res.length > 0;
os.toast(i18n.ts.quoted);
});
});
@ -493,7 +481,6 @@ function quote() {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
quoted.value = res.length > 0;
os.toast(i18n.ts.quoted);
});
});
@ -606,26 +593,6 @@ function undoRenote(note) : void {
}
}
function undoQuote(note) : void {
if (props.mock) {
return;
}
os.api("notes/unrenote", {
noteId: note.id,
quote: true
});
os.toast(i18n.ts.rmquote);
quoted.value = false;
const el = quoteButton.value as HTMLElement | null | undefined;
if (el) {
const rect = el.getBoundingClientRect();
const x = rect.left + (el.offsetWidth / 2);
const y = rect.top + (el.offsetHeight / 2);
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
}
function onContextmenu(ev: MouseEvent): void {
if (props.mock) {
return;

View file

@ -137,8 +137,7 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="quoteButton"
class="_button"
:class="$style.noteFooterButton"
:style="quoted ? 'color: var(--accent) !important;' : ''"
@mousedown="quoted ? undoQuote() : quote()"
@mousedown="quote()"
>
<i class="ph-quotes ph-bold ph-lg"></i>
</button>
@ -310,7 +309,6 @@ const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
const isDeleted = ref(false);
const renoted = ref(false);
const quoted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
const translation = ref(null);
const translating = ref(false);
@ -337,15 +335,6 @@ if ($i) {
}).then((res) => {
renoted.value = res.length > 0;
});
os.api("notes/renotes", {
noteId: appearNote.id,
userId: $i.id,
limit: 1,
quote: true,
}).then((res) => {
quoted.value = res.length > 0;
});
}
const keymap = {
@ -511,7 +500,6 @@ function quote() {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
quoted.value = res.length > 0;
os.toast(i18n.ts.quoted);
});
});
@ -534,7 +522,6 @@ function quote() {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
quoted.value = res.length > 0;
os.toast(i18n.ts.quoted);
});
});
@ -625,23 +612,6 @@ function undoRenote() : void {
}
}
function undoQuote() : void {
os.api("notes/unrenote", {
noteId: appearNote.id,
quote: true
});
os.toast(i18n.ts.rmquote);
quoted.value = false;
const el = quoteButton.value as HTMLElement | null | undefined;
if (el) {
const rect = el.getBoundingClientRect();
const x = rect.left + (el.offsetWidth / 2);
const y = rect.top + (el.offsetHeight / 2);
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
}
function onContextmenu(ev: MouseEvent): void {
const isLink = (el: HTMLElement) => {
if (el.tagName === 'A') return true;

View file

@ -41,8 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="quoteButton"
class="_button"
:class="$style.noteFooterButton"
:style="quoted ? 'color: var(--accent) !important;' : ''"
@mousedown="quoted ? undoQuote() : quote()"
@mousedown="quote()"
>
<i class="ph-quotes ph-bold ph-lg"></i>
</button>
@ -125,7 +124,6 @@ const translation = ref<any>(null);
const translating = ref(false);
const isDeleted = ref(false);
const renoted = ref(false);
const quoted = ref(false);
const reactButton = shallowRef<HTMLElement>();
const renoteButton = shallowRef<HTMLElement>();
const quoteButton = shallowRef<HTMLElement>();
@ -156,15 +154,6 @@ if ($i) {
}).then((res) => {
renoted.value = res.length > 0;
});
os.api("notes/renotes", {
noteId: appearNote.id,
userId: $i.id,
limit: 1,
quote: true,
}).then((res) => {
quoted.value = res.length > 0;
});
}
function focus() {
@ -255,23 +244,6 @@ function undoRenote() : void {
}
}
function undoQuote() : void {
os.api("notes/unrenote", {
noteId: appearNote.id,
quote: true
});
os.toast(i18n.ts.rmquote);
quoted.value = false;
const el = quoteButton.value as HTMLElement | null | undefined;
if (el) {
const rect = el.getBoundingClientRect();
const x = rect.left + (el.offsetWidth / 2);
const y = rect.top + (el.offsetHeight / 2);
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
}
let showContent = $ref(false);
watch(() => props.expandAllCws, (expandAllCws) => {
@ -342,7 +314,6 @@ function quote() {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
quoted.value = res.length > 0;
os.toast(i18n.ts.quoted);
});
});
@ -365,7 +336,6 @@ function quote() {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
quoted.value = res.length > 0;
os.toast(i18n.ts.quoted);
});
});