2021-08-26 12:01:07 +02:00
|
|
|
<script lang="ts">
|
2021-12-06 16:12:37 +01:00
|
|
|
import { blackListManager } from "../../WebRtc/BlackListManager";
|
|
|
|
import { showReportScreenStore, userReportEmpty } from "../../Stores/ShowReportScreenStore";
|
|
|
|
import { onMount } from "svelte";
|
2022-01-21 17:06:03 +01:00
|
|
|
import LL from "../../i18n/i18n-svelte";
|
2021-08-26 12:01:07 +02:00
|
|
|
|
|
|
|
export let userUUID: string | undefined;
|
|
|
|
export let userName: string;
|
|
|
|
let userIsBlocked = false;
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
if (userUUID === undefined) {
|
|
|
|
userIsBlocked = false;
|
|
|
|
console.error("There is no user to block");
|
|
|
|
} else {
|
|
|
|
userIsBlocked = blackListManager.isBlackListed(userUUID);
|
|
|
|
}
|
2021-12-06 16:12:37 +01:00
|
|
|
});
|
2021-08-26 12:01:07 +02:00
|
|
|
|
|
|
|
function blockUser(): void {
|
|
|
|
if (userUUID === undefined) {
|
|
|
|
console.error("There is no user to block");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
blackListManager.isBlackListed(userUUID)
|
|
|
|
? blackListManager.cancelBlackList(userUUID)
|
|
|
|
: blackListManager.blackList(userUUID);
|
|
|
|
showReportScreenStore.set(userReportEmpty); //close the report menu
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="block-container">
|
2022-01-21 17:06:03 +01:00
|
|
|
<h3>{$LL.report.block.title()}</h3>
|
|
|
|
<p>{$LL.report.block.content({ userName })}</p>
|
2021-08-26 12:01:07 +02:00
|
|
|
<button type="button" class="nes-btn is-error" on:click|preventDefault={blockUser}>
|
2022-01-21 17:06:03 +01:00
|
|
|
{userIsBlocked ? $LL.report.block.unblock() : $LL.report.block.block()}
|
2021-08-26 12:01:07 +02:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
div.block-container {
|
2021-12-06 16:12:37 +01:00
|
|
|
text-align: center;
|
2021-08-26 12:01:07 +02:00
|
|
|
}
|
2021-12-06 16:12:37 +01:00
|
|
|
</style>
|