Skip to content

Commit

Permalink
Merge pull request #132 from open-schools/feature/SCHOOL-831/unread-m…
Browse files Browse the repository at this point in the history
…essages-in-ticket-tables

fixes
  • Loading branch information
zavarin-michael authored May 11, 2024
2 parents 580f598 + 56d1bf6 commit 0abbf58
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 20 deletions.
1 change: 1 addition & 0 deletions apps/schools/domains/organization/redux/organizationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ const organizationApi = commonApi.injectEndpoints({
method: 'GET',
params: params,
}),
providesTags: ['Ticket'],
}),
}),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const CurrentTicket = () => {
const calculateHeight = (text: string): string => {
const lineCount = text.split('\n').length
const charCount = text.length - text.split('\n').length
const extraHeight = Math.floor(charCount / 99) * 22.5
const extraHeight = Math.floor(charCount / 67) * 22.5

return `${lineCount * 22.5 + extraHeight}px`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
}

.leftBlock {
max-width: 870px;
max-width: 800px;
width: 100%;

.commentsBlock {
margin-top: 40px;
Expand All @@ -24,6 +25,8 @@
.sendMessageBlock {
display: flex;
flex-direction: column;
max-width: 800px;
width: 100%;
gap: 12px;

.utilityBlock {
Expand All @@ -40,8 +43,8 @@
.textArea {
min-height: 64px;
max-height: 300px;
width: auto;
max-width: 800px;
width: 800px;
border-radius: 12px;
}
}
Expand All @@ -51,6 +54,7 @@
display: flex;
flex-direction: column;
gap: 20px;
padding-bottom: 60px;

.commentBlock {
display: flex;
Expand Down Expand Up @@ -97,14 +101,27 @@
}

.rightBlock {
width: auto;
margin-right: 30px;
display: flex;
flex-direction: column;
gap: 82px;
min-width: 560px;

@media (max-width: 1080px) {
min-width: 125px;
}

.selectContainer {
display: flex;
justify-content: start;
align-items: start;
}

.image {
@media (max-width: 1080px) {
display: none;
}
}
}
}
}
23 changes: 10 additions & 13 deletions apps/schools/domains/ticket/components/ticketList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ import { Table } from '@domains/common/components/table'
import { createSearchTextForRequest } from '@domains/common/utils/searchText'
import { RowType, TableType } from './interfaces'
import { searchTicketsColumns, StatusDictionary } from './constants'
import {
useGetAllJoinCircleQueriesQuery,
useGetAllTicketsQuery,
useGetOrganizationAnalyticsQuery,
useGetTicketsAnalyticsQuery,
} from '@domains/organization/redux/organizationApi'
import { useGetAllTicketsQuery, useGetTicketsAnalyticsQuery } from '@domains/organization/redux/organizationApi'
import EmptyWrapper from '@domains/common/components/containers/EmptyWrapper'
import { mapReturnedData } from '@domains/common/redux/utils'
import { HighlightText } from '@domains/common/components/table/forming'
import { isReactElement } from '@domains/common/utils/react'
import { sumObjectValues } from '@domains/common/utils/sumObjectValues'
import { CloseCircleOutlined, SearchOutlined } from '@ant-design/icons'
import { Input } from '@domains/common/components/input'
import { BubbleFilter } from '@domains/common/components/bubbleFilter'
Expand Down Expand Up @@ -76,7 +70,10 @@ export function TicketList() {

const reformattedData = mapReturnedData(tickets, (query) => {
const transformedQuery = structuredClone(query) as unknown as TableType
transformedQuery.last_message = query.last_comment.value
transformedQuery.content = query.last_comment.value
if (transformedQuery.content.length > 200) {
transformedQuery.content = transformedQuery.content.slice(0, 200) + '…'
}
transformedQuery.sender = 'Семья ' + query.sender?.name
return transformedQuery
})
Expand All @@ -89,9 +86,9 @@ export function TicketList() {

return (
<EmptyWrapper
titleText={'Список заявок пока пуст'}
descriptionText={'Дождитесь первой заявки'}
pageTitle={'Заявки'}
titleText={'Список обращений пока пуст'}
descriptionText={'Дождитесь первого обращения'}
pageTitle={'Обращения'}
data={tickets}
isLoading={isTicketsLoading}
searchTrigger={searchRequestText}
Expand Down Expand Up @@ -133,14 +130,14 @@ export function TicketList() {
columnsTitlesAndKeys={[
['Создано', 'created_at'],
['Статус', 'status'],
['Содержание', 'last_message'],
['Содержание', 'content'],
['Отправитель', 'sender'],
]}
customWidths={[10, 10, 40, 30]}
data={reformattedData}
isLoading={isTicketsLoading}
mainRoute={RoutePath[AppRoutes.TICKETS_LIST]}
searchFields={['created_at', 'last_message', 'sender']}
searchFields={['created_at', 'content', 'sender']}
customFields={{
created_at: ({ text, searchText, index }) => {
const [date, time] = new Intl.DateTimeFormat('pt-BR', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ export interface RowType {
id?: string
created_up?: string
status?: string
last_message?: string
content?: string
sender?: string
}

export interface TableType {
id?: string
created_up?: string
status?: string
last_message?: string
content?: string
sender?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
left: 24px;
}

.text-overflow {
text-overflow: ellipsis;
line-break: auto;
}

.cross {
font-size: 100%;
position: absolute;
Expand All @@ -80,4 +85,4 @@

.tags {
border-radius: 8px;
}
}

0 comments on commit 0abbf58

Please sign in to comment.