Skip to content

Commit 66c67ee

Browse files
committed
redesign the export messages button look and feel, linter errors #2
1 parent 38abcd0 commit 66c67ee

File tree

1 file changed

+22
-12
lines changed
  • frontend/src/components/Topics/Topic/Messages/Filters

1 file changed

+22
-12
lines changed

frontend/src/components/Topics/Topic/Messages/Filters/Filters.tsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import 'react-datepicker/dist/react-datepicker.css';
22

3-
import { SerdeUsage, TopicMessageConsuming, TopicMessage } from 'generated-sources';
3+
import {
4+
SerdeUsage,
5+
TopicMessageConsuming,
6+
TopicMessage,
7+
} from 'generated-sources';
48
import React, { ChangeEvent, useMemo, useState } from 'react';
59
import { format } from 'date-fns';
610
import MultiSelect from 'components/common/MultiSelect/MultiSelect.styled';
@@ -54,7 +58,7 @@ export interface FiltersProps {
5458
consumptionStats?: TopicMessageConsuming;
5559
isFetching: boolean;
5660
abortFetchData: () => void;
57-
messages?: TopicMessage[];
61+
messages?: TopicMessage[];
5862
}
5963

6064
const Filters: React.FC<FiltersProps> = ({
@@ -88,7 +92,9 @@ const Filters: React.FC<FiltersProps> = ({
8892

8993
const { data: topic } = useTopicDetails({ clusterName, topicName });
9094
const [createdEditedSmartId, setCreatedEditedSmartId] = useState<string>();
91-
const remove = useMessageFiltersStore((state: { remove: (id: string) => void }) => state.remove);
95+
const remove = useMessageFiltersStore(
96+
(state: { remove: (id: string) => void }) => state.remove
97+
);
9298

9399
// Download functionality
94100
const [showFormatSelector, setShowFormatSelector] = useState(false);
@@ -100,14 +106,16 @@ const Filters: React.FC<FiltersProps> = ({
100106

101107
const baseFileName = `topic-messages${padCurrentDateTimeString()}`;
102108

103-
const savedMessagesJson: MessageData[] = messages.map((message: TopicMessage) => ({
104-
Value: message.content,
105-
Offset: message.offset,
106-
Key: message.key,
107-
Partition: message.partition,
108-
Headers: message.headers,
109-
Timestamp: message.timestamp,
110-
}));
109+
const savedMessagesJson: MessageData[] = messages.map(
110+
(message: TopicMessage) => ({
111+
Value: message.content,
112+
Offset: message.offset,
113+
Key: message.key,
114+
Partition: message.partition,
115+
Headers: message.headers,
116+
Timestamp: message.timestamp,
117+
})
118+
);
111119

112120
const convertToCSV = useMemo(() => {
113121
return (messagesData: MessageData[]) => {
@@ -305,7 +313,8 @@ const Filters: React.FC<FiltersProps> = ({
305313
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
306314
<polyline points="7,10 12,15 17,10" />
307315
<line x1="12" y1="15" x2="12" y2="3" />
308-
</svg> Export
316+
</svg>{' '}
317+
Export
309318
</Button>
310319
{showFormatSelector && (
311320
<div
@@ -325,6 +334,7 @@ const Filters: React.FC<FiltersProps> = ({
325334
{formatOptions.map((option) => (
326335
<button
327336
key={option.value}
337+
type="button"
328338
onClick={() => handleFormatSelect(option.value)}
329339
onKeyDown={(e) => {
330340
if (e.key === 'Enter' || e.key === ' ') {

0 commit comments

Comments
 (0)