Enhance Telegram notification system with optional link support
- Updated NotifyUserAsync method in TelegramNotifier to accept an optional linkPath parameter for dynamic URL generation. - Modified various command handlers to utilize the new linkPath feature, providing users with relevant links in their notifications. - Adjusted ITelegramNotifier interface documentation to reflect the changes in method signature and functionality. - Enhanced unit tests to verify the correct invocation of the updated NotifyUserAsync method.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react'
|
||||
import { getRouteApi } from '@tanstack/react-router'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Button } from '@/shared/ui/button'
|
||||
@@ -10,11 +11,13 @@ import { TicketStatusBadge } from './TicketStatusBadge'
|
||||
import { listMyTickets } from './api'
|
||||
|
||||
const PAGE_SIZE = 20
|
||||
const routeApi = getRouteApi('/support')
|
||||
|
||||
export function SupportTicketList() {
|
||||
const { t } = useTranslation()
|
||||
const navigate = routeApi.useNavigate()
|
||||
const { ticket: selectedTicketId } = routeApi.useSearch()
|
||||
const [page, setPage] = useState(1)
|
||||
const [selectedTicketId, setSelectedTicketId] = useState<string | null>(null)
|
||||
|
||||
const { data, isLoading, isError, refetch } = useQuery({
|
||||
queryKey: ['my-tickets', page],
|
||||
@@ -44,7 +47,7 @@ export function SupportTicketList() {
|
||||
{data && data.items.length > 0 && (
|
||||
<div className="flex flex-col gap-3">
|
||||
{data.items.map((ticket) => (
|
||||
<Card key={ticket.id} className="cursor-pointer" onClick={() => setSelectedTicketId(ticket.id)}>
|
||||
<Card key={ticket.id} className="cursor-pointer" onClick={() => navigate({ search: { ticket: ticket.id } })}>
|
||||
<CardHeader className="flex-row items-center justify-between gap-2">
|
||||
<CardTitle className="text-base">{t(`support.type.${ticket.type}`)}</CardTitle>
|
||||
<TicketStatusBadge status={ticket.status} />
|
||||
@@ -71,7 +74,7 @@ export function SupportTicketList() {
|
||||
)}
|
||||
|
||||
{selectedTicketId && (
|
||||
<TicketDetailDialog ticketId={selectedTicketId} onOpenChange={(open) => !open && setSelectedTicketId(null)} />
|
||||
<TicketDetailDialog ticketId={selectedTicketId} onOpenChange={(open) => !open && navigate({ search: {} })} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -3,7 +3,14 @@ import { useTranslation } from 'react-i18next'
|
||||
import { useRequireActivated } from '@/features/auth/guards'
|
||||
import { SupportTicketList } from '@/features/support/SupportTicketList'
|
||||
|
||||
export const Route = createFileRoute('/support')({ component: SupportPage })
|
||||
export const Route = createFileRoute('/support')({
|
||||
component: SupportPage,
|
||||
// Ссылка из Telegram-уведомления об изменении статуса тикета ведёт на этот же роут с
|
||||
// ?ticket=<id> — отдельного роута на конкретный тикет нет, он открывается диалогом поверх списка.
|
||||
validateSearch: (search: Record<string, unknown>): { ticket?: string } => ({
|
||||
ticket: typeof search.ticket === 'string' ? search.ticket : undefined,
|
||||
}),
|
||||
})
|
||||
|
||||
function SupportPage() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
Reference in New Issue
Block a user