Skip to content

Commit

Permalink
import useSheets to access firstRowIsHeaders state
Browse files Browse the repository at this point in the history
modify rowNumbers with tenary to +1 or +2 to index depening on firstRowIsHeaders(true/false)
  • Loading branch information
sebastianpiresmolin committed Jan 19, 2025
1 parent 0f38f7b commit 92d4b56
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import messageIds from 'features/import/l10n/messageIds';
import ProblemRowsText from './ProblemRowsText';
import { useMessages } from 'core/i18n';
import useSheets from '../../../../hooks/useSheets';

type Props = {
description?: string;
Expand All @@ -32,7 +33,11 @@ const ImportMessage: FC<Props> = ({
}) => {
const messages = useMessages(messageIds);

const rowNumbers = rowIndices?.map((rowIndex) => rowIndex + 1);
const { firstRowIsHeaders } = useSheets();

const rowNumbers = rowIndices?.map((rowIndex) =>
firstRowIsHeaders ? rowIndex + 2 : rowIndex + 1
);

return (
<Alert
Expand Down

0 comments on commit 92d4b56

Please sign in to comment.