panel-upgrade-and-fixes
All checks were successful
Deploy on push / deploy (push) Successful in 7s

This commit is contained in:
2025-07-18 16:32:35 +03:00
parent 5d766b7601
commit 3826797317
16 changed files with 1071 additions and 1361 deletions

View File

@@ -87,7 +87,7 @@ const LoginPage = () => {
</div>
)}
<div class={formStyles.actions} style={{ 'margin': 'auto' }}>
<div class={formStyles.actions} style={{ margin: 'auto' }}>
<Button
variant="primary"
type="submit"

View File

@@ -1,7 +1,10 @@
import { Component, createSignal, createEffect, For, onMount, Show } from 'solid-js'
import { Component, createEffect, createSignal, For, onMount, Show } from 'solid-js'
import { query } from '../graphql'
import type { Query } from '../graphql/generated/schema'
import { ADMIN_DELETE_REACTION_MUTATION, ADMIN_RESTORE_REACTION_MUTATION, ADMIN_UPDATE_REACTION_MUTATION } from '../graphql/mutations'
import {
ADMIN_DELETE_REACTION_MUTATION,
ADMIN_RESTORE_REACTION_MUTATION,
ADMIN_UPDATE_REACTION_MUTATION
} from '../graphql/mutations'
import { ADMIN_GET_REACTIONS_QUERY } from '../graphql/queries'
import ReactionEditModal from '../modals/ReactionEditModal'
import styles from '../styles/Admin.module.css'
@@ -85,24 +88,22 @@ const ReactionsRoute: Component<ReactionsRouteProps> = (props) => {
const query_value = searchQuery().trim()
const isShoutId = /^\d+$/.test(query_value) // Проверяем, состоит ли запрос только из цифр
const data = await query<{ adminGetReactions: {
reactions: AdminReaction[]
total: number
page: number
perPage: number
totalPages: number
} }>(
`${location.origin}/graphql`,
ADMIN_GET_REACTIONS_QUERY,
{
search: isShoutId ? '' : query_value, // Если это ID, не передаем в обычный поиск
kind: kindFilter() || undefined,
shout_id: isShoutId ? parseInt(query_value) : undefined, // Если это ID, передаем в shout_id
status: showDeletedOnly() ? 'deleted' : 'all',
limit: pagination().limit,
offset: (pagination().page - 1) * pagination().limit
const data = await query<{
adminGetReactions: {
reactions: AdminReaction[]
total: number
page: number
perPage: number
totalPages: number
}
)
}>(`${location.origin}/graphql`, ADMIN_GET_REACTIONS_QUERY, {
search: isShoutId ? '' : query_value, // Если это ID, не передаем в обычный поиск
kind: kindFilter() || undefined,
shout_id: isShoutId ? Number.parseInt(query_value) : undefined, // Если это ID, передаем в shout_id
status: showDeletedOnly() ? 'deleted' : 'all',
limit: pagination().limit,
offset: (pagination().page - 1) * pagination().limit
})
if (data?.adminGetReactions?.reactions) {
console.log('[ReactionsRoute] Reactions loaded:', data.adminGetReactions.reactions.length)
setReactions(data.adminGetReactions.reactions as AdminReaction[])
@@ -417,7 +418,9 @@ const ReactionsRoute: Component<ReactionsRouteProps> = (props) => {
</td>
<td class={styles['body-cell']}>
<div class={styles['body-preview']}>
{reaction.body ? reaction.body.substring(0, 100) + (reaction.body.length > 100 ? '...' : '') : '-'}
{reaction.body
? reaction.body.substring(0, 100) + (reaction.body.length > 100 ? '...' : '')
: '-'}
</div>
</td>
<td>
@@ -441,12 +444,20 @@ const ReactionsRoute: Component<ReactionsRouteProps> = (props) => {
<td>
<div class={styles['actions-cell']} onClick={(e) => e.stopPropagation()}>
<Show when={reaction.deleted_at}>
<Button variant="primary" size="small" onClick={() => restoreReaction(reaction.id)}>
<Button
variant="primary"
size="small"
onClick={() => restoreReaction(reaction.id)}
>
Восстановить
</Button>
</Show>
<Show when={!reaction.deleted_at}>
<Button variant="danger" size="small" onClick={() => deleteReaction(reaction.id)}>
<Button
variant="danger"
size="small"
onClick={() => deleteReaction(reaction.id)}
>
Удалить
</Button>
</Show>

View File

@@ -273,7 +273,10 @@ const ShoutsRoute = (props: ShoutsRouteProps) => {
{(author) => (
<Show when={author}>
{(safeAuthor) => (
<span class={styles['author-badge']} title={formatAuthorTooltip(safeAuthor()!)}>
<span
class={styles['author-badge']}
title={formatAuthorTooltip(safeAuthor()!)}
>
{safeAuthor()?.name || safeAuthor()?.email || `ID:${safeAuthor()?.id}`}
</span>
)}
@@ -392,10 +395,7 @@ const ShoutsRoute = (props: ShoutsRouteProps) => {
}
>
<div style="padding: 1rem;">
<HTMLEditor
value={selectedShoutBody()}
onInput={(value) => setSelectedShoutBody(value)}
/>
<HTMLEditor value={selectedShoutBody()} onInput={(value) => setSelectedShoutBody(value)} />
</div>
</Modal>
@@ -428,10 +428,8 @@ const ShoutsRoute = (props: ShoutsRouteProps) => {
}
>
<div style="padding: 1rem;">
<HTMLEditor
value={selectedMediaBody()}
onInput={(value) => setSelectedMediaBody(value)}
/>gjl
<HTMLEditor value={selectedMediaBody()} onInput={(value) => setSelectedMediaBody(value)} />
gjl
</div>
</Modal>
</div>

View File

@@ -141,7 +141,7 @@ export const Topics = (props: TopicsProps) => {
const currentTopics = contextTopics()
console.log('[TopicsRoute] Current topics count:', currentTopics.length)
const updatedTopics = currentTopics.map(topic =>
const updatedTopics = currentTopics.map((topic) =>
topic.id === updatedTopic.id ? updatedTopic : topic
)
@@ -219,9 +219,7 @@ export const Topics = (props: TopicsProps) => {
<td class={styles.tableCell} title={topic.slug}>
{truncateText(topic.slug, 30)}
</td>
<td class={styles.tableCell}>
{renderParentTopics(topic.parent_ids)}
</td>
<td class={styles.tableCell}>{renderParentTopics(topic.parent_ids)}</td>
<td class={styles.tableCell}>
{topic.body ? (
<span style="color: #666;">{truncateText(topic.body.replace(/<[^>]*>/g, ''), 60)}</span>