From ae63d37d7876dd3e62bb9fc980fb0abd5826e918 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 10 Oct 2023 20:02:22 -0500 Subject: [PATCH] rtl.ts -> utils/rtl.ts --- src/components/autosuggest-input.tsx | 2 +- src/components/autosuggest-textarea.tsx | 2 +- src/components/preview-card.tsx | 2 +- src/components/status-content.tsx | 4 ++-- src/features/compose/components/reply-indicator.tsx | 4 ++-- src/{ => utils}/rtl.ts | 0 6 files changed, 7 insertions(+), 7 deletions(-) rename src/{ => utils}/rtl.ts (100%) diff --git a/src/components/autosuggest-input.tsx b/src/components/autosuggest-input.tsx index 1846b02d0..b41934e7c 100644 --- a/src/components/autosuggest-input.tsx +++ b/src/components/autosuggest-input.tsx @@ -7,7 +7,7 @@ import AutosuggestEmoji from 'soapbox/components/autosuggest-emoji'; import Icon from 'soapbox/components/icon'; import { Input, Portal } from 'soapbox/components/ui'; import AutosuggestAccount from 'soapbox/features/compose/components/autosuggest-account'; -import { isRtl } from 'soapbox/rtl'; +import { isRtl } from 'soapbox/utils/rtl'; import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions'; import type { Menu, MenuItem } from 'soapbox/components/dropdown-menu'; diff --git a/src/components/autosuggest-textarea.tsx b/src/components/autosuggest-textarea.tsx index bc19c15e5..233c1e4e3 100644 --- a/src/components/autosuggest-textarea.tsx +++ b/src/components/autosuggest-textarea.tsx @@ -5,7 +5,7 @@ import Textarea from 'react-textarea-autosize'; import { Portal } from 'soapbox/components/ui'; import AutosuggestAccount from 'soapbox/features/compose/components/autosuggest-account'; -import { isRtl } from 'soapbox/rtl'; +import { isRtl } from 'soapbox/utils/rtl'; import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions'; import AutosuggestEmoji from './autosuggest-emoji'; diff --git a/src/components/preview-card.tsx b/src/components/preview-card.tsx index 756e7d528..16a1a467c 100644 --- a/src/components/preview-card.tsx +++ b/src/components/preview-card.tsx @@ -5,8 +5,8 @@ import React, { useState, useEffect } from 'react'; import Blurhash from 'soapbox/components/blurhash'; import { HStack, Stack, Text, Icon } from 'soapbox/components/ui'; import { normalizeAttachment } from 'soapbox/normalizers'; -import { getTextDirection } from 'soapbox/rtl'; import { addAutoPlay } from 'soapbox/utils/media'; +import { getTextDirection } from 'soapbox/utils/rtl'; import type { Card as CardEntity, Attachment } from 'soapbox/types/entities'; diff --git a/src/components/status-content.tsx b/src/components/status-content.tsx index 7c322dcb8..ffc044df2 100644 --- a/src/components/status-content.tsx +++ b/src/components/status-content.tsx @@ -6,7 +6,7 @@ import { useHistory } from 'react-router-dom'; import Icon from 'soapbox/components/icon'; import { onlyEmoji as isOnlyEmoji } from 'soapbox/utils/rich-content'; -import { isRtl } from '../rtl'; +import { getTextDirection } from '../utils/rtl'; import Markup from './markup'; import Poll from './polls/poll'; @@ -142,7 +142,7 @@ const StatusContent: React.FC = ({ const baseClassName = 'text-gray-900 dark:text-gray-100 break-words text-ellipsis overflow-hidden relative focus:outline-none'; const content = { __html: parsedHtml }; - const direction = isRtl(status.search_index) ? 'rtl' : 'ltr'; + const direction = getTextDirection(status.search_index); const className = clsx(baseClassName, { 'cursor-pointer': onClick, 'whitespace-normal': withSpoiler, diff --git a/src/features/compose/components/reply-indicator.tsx b/src/features/compose/components/reply-indicator.tsx index d5478d204..bee36b661 100644 --- a/src/features/compose/components/reply-indicator.tsx +++ b/src/features/compose/components/reply-indicator.tsx @@ -5,7 +5,7 @@ import AttachmentThumbs from 'soapbox/components/attachment-thumbs'; import Markup from 'soapbox/components/markup'; import { Stack } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account-container'; -import { isRtl } from 'soapbox/rtl'; +import { getTextDirection } from 'soapbox/utils/rtl'; import type { Status } from 'soapbox/types/entities'; @@ -50,7 +50,7 @@ const ReplyIndicator: React.FC = ({ className, status, hideActi className='break-words' size='sm' dangerouslySetInnerHTML={{ __html: status.contentHtml }} - direction={isRtl(status.search_index) ? 'rtl' : 'ltr'} + direction={getTextDirection(status.search_index)} /> {status.media_attachments.size > 0 && ( diff --git a/src/rtl.ts b/src/utils/rtl.ts similarity index 100% rename from src/rtl.ts rename to src/utils/rtl.ts