Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(forum): use the edit2 page for editing #3068

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions app/Community/Livewire/Forms/ForumTopicCommentForm.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Community/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function mapWebRoutes(): void
Route::get('user/{user}/moderation-comments', [UserModerationCommentController::class, 'index'])->name('user.moderation-comment.index');

Route::get('forums/recent-posts', [ForumTopicController::class, 'recentPosts'])->name('forum.recent-posts');
Route::get('forums/post/{comment}/edit2', [ForumTopicCommentController::class, 'edit'])->name('forum-topic-comment.edit');
Route::get('forums/post/{comment}/edit', [ForumTopicCommentController::class, 'edit'])->name('forum-topic-comment.edit');

Route::get('user/{user}/posts', [UserForumTopicCommentController::class, 'index'])->name('user.posts.index');
Route::get('user/{user}/achievement-checklist', [UserAchievementChecklistController::class, 'index'])->name('user.achievement-checklist');
Expand Down
11 changes: 3 additions & 8 deletions resources/js/common/components/+vendor/BaseAutosizeTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,26 @@ export const useBaseAutosizeTextArea = ({

// Use useIsomorphicLayoutEffect to prevent layout flickering on client hydration.
useIsomorphicLayoutEffect(() => {
// We need to reset the height momentarily to get the correct scrollHeight for the textarea.
const offsetBorder = 6;
const textAreaElement = textAreaRef.current;

if (textAreaElement) {
if (init) {
textAreaElement.style.minHeight = `${minHeight + offsetBorder}px`;
textAreaElement.style.minHeight = `${minHeight}px`;
if (maxHeight > minHeight) {
textAreaElement.style.maxHeight = `${maxHeight}px`;
}
setInit(false);
}

// Store the current scroll position to restore it after resizing.
const scrollPos = window.scrollY;

textAreaElement.style.height = `${minHeight + offsetBorder}px`;
textAreaElement.style.height = `${minHeight}px`;
const scrollHeight = textAreaElement.scrollHeight;

// We then set the height directly, outside of the render loop.
// Trying to set this with state or a ref will produce an incorrect value.
if (scrollHeight > maxHeight) {
textAreaElement.style.height = `${maxHeight}px`;
} else {
textAreaElement.style.height = `${scrollHeight + offsetBorder}px`;
textAreaElement.style.height = `${scrollHeight}px`;
}

// Restore the scroll position to prevent page jumps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export const EditPostForm: FC<EditPostFormProps> = ({ onPreview }) => {
<BaseFormLabel className="sr-only">{t('Body')}</BaseFormLabel>
<BaseFormControl>
<BaseAutosizeTextarea
className="min-h-[308px] p-3"
className="p-3"
placeholder="Don't ask for links to copyrighted ROMs. Don't share links to copyrighted ROMs."
minHeight={308}
maxLength={60_000}
minHeight={308}
{...field}
/>
</BaseFormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@can('update', $forumTopicComment)
<a
href="{{ route('forum.post.edit', ['forumTopicComment' => $forumTopicComment]) }}"
href="{{ route('forum-topic-comment.edit', ['comment' => $forumTopicComment]) }}"
class='btn p-1 lg:text-xs'
>
Edit
Expand Down
56 changes: 0 additions & 56 deletions resources/views/livewire/forum/edit-topic-comment-form.blade.php

This file was deleted.

This file was deleted.