remove comments

This commit is contained in:
fsociety
2024-09-10 21:17:28 +02:00
parent cf15c22116
commit 8f05a7a5cb
30 changed files with 0 additions and 630 deletions

View File

@@ -1,15 +0,0 @@
@php
$defaultImage = Spatie\Comments\Support\Config::getGravatarDefaultImage();
$defaultAvatar = "https://www.gravatar.com/avatar/unknown?d={$defaultImage}";
if ($user = auth()->user()) {
$segment = md5(strtolower($user->email));
$defaultAvatar = "https://www.gravatar.com/avatar/{$segment}?d={$defaultImage}";
}
@endphp
{{--<img
class="comments-avatar"
src="{{ isset($comment) && $comment->commentatorProperties() ? $comment->commentatorProperties()->avatar : $defaultAvatar }}"
alt="avatar"
>--}}

View File

@@ -1,12 +0,0 @@
<button
type="{{ isset($submit) && $submit ? 'submit' : 'button' }}"
@class([
'comments-button',
'is-small' => isset($small) && $small,
'is-danger' => isset($danger) && $danger,
'is-link' => isset($link) && $link,
])
{{ $attributes->except('type', 'size', 'submit') }}
>
{{ $slot }}
</button>

View File

@@ -1,7 +0,0 @@
<time datetime="$date->format('Y-m-d H:i:s')" class="comments-date">
@if($date->diffInMinutes() < 1)
{{ __('comments::comments.just_now') }}
@else
{{ $date->diffForHumans() }}
@endif
</time>

View File

@@ -1,104 +0,0 @@
<div
x-data="compose({ text: @entangle($model), autofocus: @json($autofocus ?? false) })"
x-init="
$wire.on('comment', clear);
@isset($comment)
$wire.on('reply-{{ $comment->id }}', () => {
clear();
});
@endisset
"
>
<div wire:ignore>
<textarea placeholder="{{ $placeholder ?? '' }}"></textarea>
</div>
<div class="comments-form-editor-tip">
{!! __('You can use <a href="https://spatie.be/markdown" target="_blank" rel="nofollow noopener noreferrer">Markdown</a>') !!}
</div>
</div>
@push('comments-scripts')
<script>
document.addEventListener("alpine:init", () => {
window.Alpine.data("compose", ({ text, autofocus = false } = {}) => {
// Store the editor as a non-reactive instance property
let editor;
return {
text,
init() {
if (editor) {
return;
}
const textarea = this.$el.querySelector("textarea");
if (!textarea) {
return;
}
this.loadEasyMDE().then(() => {
editor = new window.EasyMDE({
element: textarea,
hideIcons: [
"heading",
"image",
"preview",
"side-by-side",
"fullscreen",
"guide",
],
spellChecker: false,
status: false,
insertTexts: {
link: ["[", "](https://)"],
},
});
editor.value(this.text);
if (autofocus) {
editor.codemirror.focus();
editor.codemirror.setCursor(editor.codemirror.lineCount(), 0);
}
editor.codemirror.on("change", () => {
this.text = editor.value();
});
});
},
clear() {
editor.value("");
},
loadEasyMDE() {
if (window.EasyMDE) {
return Promise.resolve();
}
const loadScript = new Promise((resolve) => {
const script = document.createElement("script");
script.src = "https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.js";
script.addEventListener("load", resolve);
document.getElementsByTagName("head")[0].appendChild(script);
});
const loadCss = new Promise((resolve) => {
const link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = "https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css";
link.addEventListener("load", resolve);
document.getElementsByTagName("head")[0].appendChild(link);
});
return Promise.all([loadScript, loadCss]);
},
};
});
});
</script>
@endpush

View File

@@ -1 +0,0 @@
<textarea wire:model.lazy="{{ $model }}" @isset($autofocus) autofocus @endisset class="comments-textarea"></textarea>

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="comments-icon"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>

Before

Width:  |  Height:  |  Size: 219 B

View File

@@ -1 +0,0 @@
<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="comments-icon"><path stroke-width="0" d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"></path></svg>

Before

Width:  |  Height:  |  Size: 645 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="comments-icon"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>

Before

Width:  |  Height:  |  Size: 323 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="comments-icon"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"/></svg>

Before

Width:  |  Height:  |  Size: 295 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="comments-icon"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"/></svg>

Before

Width:  |  Height:  |  Size: 316 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="comments-icon"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>

Before

Width:  |  Height:  |  Size: 283 B

View File

@@ -1,14 +0,0 @@
<div
x-cloak
@class(['comments-modal', 'is-compact' => $compact ?? false, 'is-left' => $left ?? false, 'is-bottom' => $bottom ?? false])
{{ $attributes }}
>
@isset($title)
<p class="comments-modal-title">
{{ $title }}
</p>
@endisset
<div class="comments-modal-contents">
{{ $slot }}
</div>
</div>

View File

@@ -1,9 +0,0 @@
<script>
if (window.Alpine) {
console.warn(
'Laravel Comments scripts were loaded after Alpine. ' +
'Please ensure Alpine is loaded last so Laravel Comments can initialize first.'
);
}
</script>
@stack('comments-scripts')

View File

@@ -1,3 +0,0 @@
<style>
{{ $stylesheet }}
</style>

View File

@@ -1,196 +0,0 @@
<div
id="comment-{{ $comment->id }}"
class="comments-group"
x-data="{ confirmDelete: false, urlCopied: false }"
x-effect="
if (urlCopied) {
window.navigator.clipboard.writeText(window.location.href.split('#')[0] + '#comment-{{ $comment->id }}');
window.setTimeout(() => urlCopied = false, 2000);
}
"
>
<div class="comments-comment">
@if($showAvatar)
<x-comments::avatar :comment="$comment"/>
@endif
<div class="comments-comment-inner">
<div class="comments-comment-header">
@if($url = $comment->commentatorProperties()?->url)
<a href="{{ $url }}">
{{ $comment->commentatorProperties()->name }}
</a>
@else
{{ $comment->commentatorProperties()?->name ?? __('comments::comments.guest') }}
@endif
<ul class="comments-comment-header-actions">
<li>
<a
href="#comment-{{ $comment->id }}"
@click.prevent="urlCopied = true"
>
<x-comments::date :date="$comment->created_at"/>
<span class="comments-comment-header-copied" x-show="urlCopied" style="display: none;">
{{ __('comments::comments.copied') }}!
</span>
</a>
</li>
@if($writable)
@can('update', $comment)
<li>
<a href="#" wire:click.prevent="startEditing" aria-role="button">{{__('comments::comments.edit')}}</a>
</li>
@endcan
@can('delete', $comment)
<li>
<a href="#" @click.prevent="confirmDelete = true" aria-role="button">{{__('comments::comments.delete')}}</a>
<x-comments::modal
right
bottom
x-show="confirmDelete"
@click.outside="confirmDelete = false"
:title="__('comments::comments.delete_confirmation_title')"
>
<p>{{ __('comments::comments.delete_confirmation_text') }}</p>
<x-comments::button danger small wire:click="deleteComment">
{{ __('comments::comments.delete') }}
</x-comments::button>
</x-comments::modal>
</li>
@endcan
@endif
@include('comments::extraCommentHeaderActions')
</ul>
</div>
@if($comment->isPending())
<div class="comments-approval">
<span>
{{__('comments::comments.awaits_approval')}}
</span>
<span class="comments-approval-buttons">
@can('reject', $comment)
<button
class="comments-button is-small is-danger"
wire:click="reject">
{{__('comments::comments.reject_comment')}}
</button>
@endcan
@can('approve', $comment)
<button
class="comments-button is-small"
wire:click="approve">
{{__('comments::comments.approve_comment')}}
</button>
@endcan
</span>
</div>
@endif
@if($isEditing)
<div class="comments-form">
<form class="comments-form-inner" wire:submit.prevent="edit">
<x-dynamic-component
:component="\Spatie\LivewireComments\Support\Config::editor()"
model="editText"
:comment="$comment"
autofocus
/>
@error('editText')
<p class="comments-error">
{{ $message }}
</p>
@enderror
<x-comments::button submit>
{{ __('comments::comments.edit_comment') }}
</x-comments::button>
<x-comments::button link wire:click="stopEditing">
{{ __('comments::comments.cancel') }}
</x-comments::button>
</form>
</div>
@else
<div class="comment-text">
{!! $comment->text !!}
</div>
@if($writable || $comment->reactions->summary()->isNotEmpty())
<div class="comments-reactions">
@foreach($comment->reactions->summary() as $summary)
<div
wire:key="{{ $comment->id }}{{$summary['reaction']}}"
@auth
wire:click="toggleReaction('{{ $summary['reaction'] }}')"
@endauth
@class(['comments-reaction', 'is-reacted' => $summary['commentator_reacted']])
>
{{ $summary['reaction'] }} {{ $summary['count'] }}
</div>
@endforeach
@if($writable)
<div
x-cloak
x-data="{ open: false }"
@click.outside="open = false"
class="comments-reaction-picker"
>
@can('react', $comment)
<button class="comments-reaction-picker-trigger" type="button"
@click="open = !open">
<x-comments::icons.smile/>
</button>
<x-comments::modal x-show="open" compact left>
<div class="comments-reaction-picker-reactions">
@foreach(config('comments.allowed_reactions') as $reaction)
@php
$commentatorReacted = ! is_bool(array_search(
$reaction,
array_column($comment->reactions->toArray(), 'reaction'),
));
@endphp
<button
type="button"
@class(['comments-reaction-picker-reaction', 'is-reacted' => $commentatorReacted])
wire:click="toggleReaction('{{ $reaction }}')"
>
{{ $reaction }}
</button>
@endforeach
</div>
</x-comments::modal>
@endcan
</div>
@endif
</div>
@endif
@endif
</div>
</div>
@if($showReplies)
@if($comment->isTopLevel())
<div class="comments-nested">
@if($this->newestFirst)
@if(auth()->check() || config('comments.allow_anonymous_comments'))
@include('comments::livewire.partials.replyTo')
@endif
@endif
@foreach ($comment->nestedComments as $nestedComment)
@can('see', $nestedComment)
<livewire:comments-comment
:key="$nestedComment->id"
:comment="$nestedComment"
:show-avatar="$showAvatar"
:newest-first="$newestFirst"
:writable="$writable"
/>
@endcan
@endforeach
@if(! $this->newestFirst)
@if(auth()->check() || config('comments.allow_anonymous_comments'))
@include('comments::livewire.partials.replyTo')
@endif
@endif
</div>
@endif
@endif
</div>

View File

@@ -1,61 +0,0 @@
@php
use Spatie\Comments\Enums\NotificationSubscriptionType;
@endphp
<section class="comments {{ $newestFirst ? 'comments-newest-first' : '' }}">
<header class="comments-header">
@if($writable)
@auth
@if($showNotificationOptions)
<div x-data="{ subscriptionsOpen: false}" class="comments-subscription">
<button @click.prevent="subscriptionsOpen = true" class="comments-subscription-trigger">
{{ NotificationSubscriptionType::from($selectedNotificationSubscriptionType)->longDescription() }}
</button>
<x-comments::modal
bottom
compact
x-show="subscriptionsOpen"
@click.outside="subscriptionsOpen = false"
>
@foreach(NotificationSubscriptionType::cases() as $case)
<button class="comments-subscription-item" @click="subscriptionsOpen = false" wire:click="updateSelectedNotificationSubscriptionType('{{ $case->value }}')">
{{ $case->description() }}
</button>
@endforeach
</x-comments::modal>
</div>
@endif
@endif
@endauth
</header>
@if ($newestFirst)
@include('comments::livewire.partials.newComment')
@endif
@if($comments->count())
@foreach($comments as $comment)
@can('see', $comment)
<livewire:comments-comment
:key="$comment->id"
:comment="$comment"
:show-avatar="$showAvatars"
:newest-first="$newestFirst"
:writable="$writable"
:show-replies="$showReplies"
/>
@endcan
@endforeach
@if ($comments->hasPages())
{{ $comments->links() }}
@endif
@else
<p class="comments-no-comment-yet">{{ $noCommentsText ?? __('comments::comments.no_comments_yet') }}</p>
@endif
@if (! $newestFirst)
@include('comments::livewire.partials.newComment')
@endif
</section>

View File

@@ -1,24 +0,0 @@
@if($writable)
@can('createComment', $model)
<div class="comments-form">
@if($showAvatars)
<x-comments::avatar/>
@endif
<form class="comments-form-inner" wire:submit.prevent="comment">
<x-dynamic-component
:component="\Spatie\LivewireComments\Support\Config::editor()"
model="text"
:placeholder="__('comments::comments.write_comment')"
/>
@error('text')
<p class="comments-error">
{{ $message }}
</p>
@enderror
<x-comments::button submit>
{{ __('comments::comments.create_comment') }}
</x-comments::button>
</form>
</div>
@endcan
@endif

View File

@@ -1,47 +0,0 @@
@if($writable)
<div class="comments-form comments-reply">
@if($showAvatar)
<x-comments::avatar/>
@endif
<form class="comments-form-inner" wire:submit.prevent="reply">
<div
x-data="{ isExpanded: false }"
x-init="
$wire.on('reply-{{ $comment->id }}', () => {
isExpanded = false;
});
"
>
<input
x-show="!isExpanded"
@click="isExpanded = true"
@focus="isExpanded = true"
class="comments-placeholder"
placeholder="{{ __('comments::comments.write_reply') }}"
>
<div x-show="isExpanded">
<div>
<x-dynamic-component
:component="\Spatie\LivewireComments\Support\Config::editor()"
model="replyText"
:comment="$comment"
:placeholder="__('comments::comments.write_reply')"
autofocus
/>
@error('replyText')
<p class="comments-error">
{{ $message }}
</p>
@enderror
<x-comments::button submit>
{{ __('comments::comments.create_reply') }}
</x-comments::button>
<x-comments::button link @click="isExpanded = false">
{{ __('comments::comments.cancel') }}
</x-comments::button>
</div>
</div>
</div>
</form>
</div>
@endif

View File

@@ -1,24 +0,0 @@
@component('mail::message')
# {{ __('comments::notifications.approved_comment_mail_title', [
'commentable_name' => $topLevelComment->commentable->commentableName(),
'commentable_url' => $topLevelComment->commentable->commentUrl(),
'commentator_name' => $comment->commentatorProperties()->name ?? 'anonymous',
]) }}
{{ __('comments::notifications.approved_comment_mail_body', [
'commentable_name' => $topLevelComment->commentable->commentableName(),
'commentable_url' => $topLevelComment->commentable->commentUrl(),
'commentator_name' => $comment->commentatorProperties()->name ?? 'anonymous',
]) }}
{!! $comment->text !!}
@component('mail::button', ['url' => $comment->commentUrl()])
{{ __('comments::notifications.view_comment') }}
@endcomponent
@if($unsubscribeUrl = $commentator->unsubscribeFromCommentNotificationsUrl($comment))
<a href="{{ $unsubscribeUrl }}">{{ __('Unsubscribe from receive notification about :commentableName', ['commentableName' => $topLevelComment->commentable->commentableName()]) }}</a>
@endif
@endcomponent

View File

@@ -1,20 +0,0 @@
@component('mail::message')
{{ __('comments::notifications.pending_comment_mail_body', [
'commentable_name' => $topLevelComment->commentable->commentableName(),
'commentator_name' => $comment->commentatorProperties()->name ?? 'anonymous',
]) }}
[{{ __('comments::notifications.view_comment') }}]({{ $comment->commentUrl() }})
{!! $comment->text !!}
@component('mail::button', ['url' => $comment->approveUrl()])
{{ __('comments::notifications.approve_comment') }}
@endcomponent
@component('mail::button', ['url' => $comment->rejectUrl()])
{{ __('comments::notifications.reject_comment') }}
@endcomponent
@endcomponent

View File

@@ -1,5 +0,0 @@
<x-comments::signed-layout>
{{ __('The comment has been approved.') }}
</x-comments::signed-layout>

View File

@@ -1,15 +0,0 @@
<x-comments::signed-layout>
{{ __('Do you want to approve the comment?') }}
<form class="form" method="POST">
@csrf
<button id="confirmationButton" class="button" type="submit">{{ __('Approve') }}</button>
</form>
</x-comments::signed-layout>
<script>
document.getElementById("confirmationButton").click();
</script>

View File

@@ -1,5 +0,0 @@
<x-comments::signed-layout>
{{ __('The comment has been rejected.') }}
</x-comments::signed-layout>

View File

@@ -1,14 +0,0 @@
<x-comments::signed-layout>
{{ __('Do you want to reject the comment?') }}
<form class="form" method="POST">
@csrf
<button id="confirmationButton" class="button" type="submit">Approve</button>
</form>
</x-comments::signed-layout>
<script>
document.getElementById("confirmationButton").click();
</script>

View File

@@ -1,5 +0,0 @@
<x-comments::signed-layout>
{{ __('You have been unsubscribed.') }}
</x-comments::signed-layout>

View File

@@ -1,5 +0,0 @@
<x-comments::signed-layout>
{{ __('You have been unsubscribed from every comment notification.') }}
</x-comments::signed-layout>

View File

@@ -1,14 +0,0 @@
<x-comments::signed-layout>
{{ __('Do you want to unsubscribe from every comment notification?') }}
<form class="form" method="POST">
@csrf
<button id="confirmationButton" class="button" type="submit">{{ __('Approve') }}</button>
</form>
</x-comments::signed-layout>
<script>
document.getElementById("confirmationButton").click();
</script>

View File

@@ -1,14 +0,0 @@
<x-comments::signed-layout>
{{ __('Do you want to unsubscribe?') }}
<form class="form" method="POST">
@csrf
<button id="confirmationButton" class="button" type="submit">{{ __('Approve') }}</button>
</form>
</x-comments::signed-layout>
<script>
document.getElementById("confirmationButton").click();
</script>

View File

@@ -1,10 +0,0 @@
<html lang="en">
<head>
</head>
<body>
<div>
{{ $slot }}
</div>
</body>
</html>