From c4b634aa73c9d8fc02221c76355466dabba5b7ba Mon Sep 17 00:00:00 2001 From: Eli Mallon Date: Mon, 2 Jun 2025 09:58:15 -0700 Subject: [PATCH] chore: add and run pretter-plugin-organize-imports (#244) --- .prettierrc | 3 +- js/app/components/aqlink.tsx | 10 ++- js/app/components/chat/chat-box.tsx | 36 +++++----- js/app/components/chat/chat.tsx | 12 ++-- js/app/components/chat/emoji-suggestions.tsx | 2 +- .../components/chat/mention-suggestions.tsx | 2 +- js/app/components/countdown.tsx | 2 +- js/app/components/create-livestream.tsx | 12 ++-- .../components/debug/breakpoint-indicator.tsx | 3 +- js/app/components/edit-livestream.tsx | 6 +- .../components/emoji-picker/emoji-picker.tsx | 3 +- js/app/components/error/error.tsx | 2 +- js/app/components/follow-button.tsx | 8 +-- js/app/components/get-apps.tsx | 2 +- js/app/components/home/cards.tsx | 4 +- js/app/components/home/live-dot.tsx | 6 +- js/app/components/index.tsx | 2 +- .../components/live-dashboard/stream-key.tsx | 6 +- js/app/components/live-dashboard/waiting.tsx | 2 +- js/app/components/livestream/livestream.tsx | 16 ++--- js/app/components/loading/loading.tsx | 2 +- js/app/components/login/login.tsx | 9 ++- js/app/components/login/signup.tsx | 8 +-- .../name-color-picker/name-color-picker.tsx | 2 +- js/app/components/player/controls.tsx | 46 ++++++------- .../components/player/fullscreen.native.tsx | 17 ++--- js/app/components/player/player-loading.tsx | 2 +- js/app/components/player/player.tsx | 18 ++--- js/app/components/player/props.tsx | 1 - js/app/components/player/shared.tsx | 2 +- js/app/components/player/video-retry.tsx | 4 +- js/app/components/player/video.native.tsx | 7 +- js/app/components/player/video.tsx | 1 - js/app/components/popup.tsx | 2 +- .../components/provider/provider.shared.tsx | 6 +- js/app/components/provider/provider.tsx | 4 +- js/app/components/settings/settings.tsx | 8 +-- js/app/components/settings/updates.native.tsx | 4 +- js/app/components/settings/updates.tsx | 2 +- js/app/components/sidebar/sidebar-item.tsx | 4 +- js/app/components/sidebar/sidebar.tsx | 12 ++-- .../thumbnail-selector/thumbnail-selector.tsx | 2 +- js/app/components/timer.tsx | 4 +- js/app/components/ui/button-selector.tsx | 2 +- js/app/components/viewers.tsx | 2 +- js/app/contexts/FullscreenContext.tsx | 4 +- js/app/contexts/VideoElementContext.tsx | 2 +- js/app/features/bluesky/agent.tsx | 5 +- js/app/features/bluesky/blueskyProvider.tsx | 1 - js/app/features/bluesky/blueskyTypes.tsx | 4 +- .../platform/platformSlice.native.tsx | 10 +-- js/app/features/player/playerSlice.tsx | 10 +-- .../streamplace/streamplaceProvider.tsx | 6 +- .../features/streamplace/streamplaceSlice.tsx | 5 +- js/app/hooks/useAvatars.tsx | 6 +- js/app/hooks/useCaptureVideoFrame.ts | 2 +- js/app/hooks/usePreloadEmoji.ts | 2 +- js/app/hooks/useSidebarControl.tsx | 6 +- js/app/hooks/useWallet.shared.tsx | 2 +- js/app/hooks/useWallet.tsx | 13 ++-- js/app/src/entrypoint.tsx | 2 +- js/app/src/router.tsx | 66 +++++++++---------- js/app/src/screens/about.tsx | 2 +- js/app/src/screens/av-sync.tsx | 8 +-- js/app/src/screens/download.tsx | 2 +- js/app/src/screens/embed.tsx | 2 +- js/app/src/screens/home.tsx | 17 +++-- js/app/src/screens/live-dashboard.tsx | 25 ++++--- js/app/src/screens/stream.tsx | 4 +- js/app/storage/storage.native.tsx | 2 +- js/app/store/listener.ts | 2 +- js/app/store/store.tsx | 4 +- js/app/tamagui.config.ts | 2 +- js/app/utils/videoCapture.ts | 2 +- js/desktop/src/env.ts | 2 +- js/desktop/src/index.ts | 5 +- js/desktop/src/node.ts | 6 +- js/desktop/src/tests/playback-test.ts | 2 +- js/desktop/src/tests/sync-test.ts | 6 +- js/desktop/src/tests/test-runner.ts | 10 +-- js/desktop/src/updater.ts | 6 +- js/desktop/src/window.ts | 2 +- js/desktop/webpack.main.config.ts | 2 +- js/desktop/webpack.renderer.config.ts | 2 +- js/docs/astro.config.mjs | 2 +- js/docs/src/content.config.ts | 2 +- package.json | 3 +- pnpm-lock.yaml | 18 +++++ 88 files changed, 301 insertions(+), 295 deletions(-) diff --git a/.prettierrc b/.prettierrc index 1de299a7c..d543f10fe 100644 --- a/.prettierrc +++ b/.prettierrc @@ -7,5 +7,6 @@ "proseWrap": "preserve" } } - ] + ], + "plugins": ["prettier-plugin-organize-imports"] } diff --git a/js/app/components/aqlink.tsx b/js/app/components/aqlink.tsx index b07445e82..168affb48 100644 --- a/js/app/components/aqlink.tsx +++ b/js/app/components/aqlink.tsx @@ -1,9 +1,13 @@ -import { Link, useNavigation } from "@react-navigation/native"; -import { NavigationProp, ParamListBase } from "@react-navigation/native"; +import { + Link, + NavigationProp, + ParamListBase, + useNavigation, +} from "@react-navigation/native"; import usePlatform from "hooks/usePlatform"; +import { useEffect } from "react"; import { Pressable, StyleProp, ViewStyle } from "react-native"; import Loading from "./loading/loading"; -import { useEffect } from "react"; export type LinkParams = { screen: string; params?: Record }; diff --git a/js/app/components/chat/chat-box.tsx b/js/app/components/chat/chat-box.tsx index 2f0d2a712..822f00d22 100644 --- a/js/app/components/chat/chat-box.tsx +++ b/js/app/components/chat/chat-box.tsx @@ -1,40 +1,40 @@ import { useNavigation } from "@react-navigation/native"; +import { + Palette, + SquareArrowOutUpRight, + X as XIcon, +} from "@tamagui/lucide-icons"; import { useToastController } from "@tamagui/toast"; +import { emojiEmitter } from "components/emoji-picker/emoji-emitter"; +import { EmojiPicker } from "components/emoji-picker/emoji-picker"; +import NameColorPicker from "components/name-color-picker/name-color-picker"; import { chatMessage, + selectChatProfile, selectIsReady, selectUserProfile, - selectChatProfile, } from "features/bluesky/blueskySlice"; import { - LivestreamViewHydrated, - usePlayerLivestream, addLocalChatMessage, + LivestreamViewHydrated, + MessageViewHydrated, + useChat, + usePlayerActions, usePlayerId, + usePlayerLivestream, useReplyToMessage, - usePlayerActions, - useChat, - MessageViewHydrated, } from "features/player/playerSlice"; import { chatWarn, selectChatWarned, } from "features/streamplace/streamplaceSlice"; -import { useRef, useState, useEffect } from "react"; +import { usePreloadEmoji } from "hooks/usePreloadEmoji"; +import { useEffect, useRef, useState } from "react"; import { Keyboard } from "react-native"; import { useAppDispatch, useAppSelector } from "store/hooks"; -import { Button, Form, Input, isWeb, TextArea, View, Text } from "tamagui"; -import { - Palette, - SquareArrowOutUpRight, - X as XIcon, -} from "@tamagui/lucide-icons"; -import NameColorPicker from "components/name-color-picker/name-color-picker"; -import MentionSuggestions, { MentionSuggestion } from "./mention-suggestions"; -import { emojiEmitter } from "components/emoji-picker/emoji-emitter"; -import { EmojiPicker } from "components/emoji-picker/emoji-picker"; +import { Button, Form, Input, isWeb, Text, TextArea, View } from "tamagui"; import EmojiSuggestions, { EmojiSuggestion } from "./emoji-suggestions"; -import { usePreloadEmoji } from "hooks/usePreloadEmoji"; +import MentionSuggestions, { MentionSuggestion } from "./mention-suggestions"; const getParticipantSuggestions = ( chat: MessageViewHydrated[], diff --git a/js/app/components/chat/chat.tsx b/js/app/components/chat/chat.tsx index ba7f033b9..37855ab90 100644 --- a/js/app/components/chat/chat.tsx +++ b/js/app/components/chat/chat.tsx @@ -1,4 +1,4 @@ -import { Settings, X, Reply } from "@tamagui/lucide-icons"; +import { Reply, Settings, X } from "@tamagui/lucide-icons"; import { createBlockRecord, selectUserProfile, @@ -6,23 +6,23 @@ import { import { MessageViewHydrated, useChat, - usePlayerLivestream, usePlayerActions, + usePlayerLivestream, } from "features/player/playerSlice"; +import usePlatform from "hooks/usePlatform"; import { useEffect, useRef, useState } from "react"; -import { TouchableOpacity, Linking } from "react-native"; +import { Linking, TouchableOpacity } from "react-native"; import { useAppDispatch, useAppSelector } from "store/hooks"; -import usePlatform from "hooks/usePlatform"; -import { Button, ScrollView, Sheet, Text, useMedia, View } from "tamagui"; import { RichText } from "@atproto/api"; import { isMention, Link, Mention, } from "@atproto/api/dist/client/types/app/bsky/richtext/facet"; -import { RichtextSegment, segmentize } from "../../utils/facet"; import { $Typed } from "@atproto/api/src/client/util"; +import { Button, ScrollView, Sheet, Text, useMedia, View } from "tamagui"; +import { RichtextSegment, segmentize } from "../../utils/facet"; export default function Chat({ isChatVisible, diff --git a/js/app/components/chat/emoji-suggestions.tsx b/js/app/components/chat/emoji-suggestions.tsx index cd476acd2..ec1de362b 100644 --- a/js/app/components/chat/emoji-suggestions.tsx +++ b/js/app/components/chat/emoji-suggestions.tsx @@ -1,5 +1,5 @@ -import { ScrollView, Text, View } from "tamagui"; import { TouchableOpacity } from "react-native"; +import { ScrollView, Text, View } from "tamagui"; export interface EmojiSuggestion { emoji: string; diff --git a/js/app/components/chat/mention-suggestions.tsx b/js/app/components/chat/mention-suggestions.tsx index a54f45a67..804a709b2 100644 --- a/js/app/components/chat/mention-suggestions.tsx +++ b/js/app/components/chat/mention-suggestions.tsx @@ -1,5 +1,5 @@ -import { ScrollView, Text, View } from "tamagui"; import { TouchableOpacity } from "react-native"; +import { ScrollView, Text, View } from "tamagui"; export interface MentionSuggestion { did: string; diff --git a/js/app/components/countdown.tsx b/js/app/components/countdown.tsx index 3990aa748..be44a6ad2 100644 --- a/js/app/components/countdown.tsx +++ b/js/app/components/countdown.tsx @@ -1,3 +1,4 @@ +import * as chrono from "chrono-node"; import { useEffect, useState } from "react"; import { Text, @@ -7,7 +8,6 @@ import { useMedia, useWindowDimensions, } from "tamagui"; -import * as chrono from "chrono-node"; const CountdownBox = styled(View, { alignSelf: "center", diff --git a/js/app/components/create-livestream.tsx b/js/app/components/create-livestream.tsx index a0aeec1cf..cffd2eff7 100644 --- a/js/app/components/create-livestream.tsx +++ b/js/app/components/create-livestream.tsx @@ -1,16 +1,16 @@ -import { useEffect, useState } from "react"; -import { Button, Label, Paragraph, TextArea, View, isWeb } from "tamagui"; import { useToastController } from "@tamagui/toast"; +import ThumbnailSelector from "components/thumbnail-selector"; import { createLivestreamRecord, selectNewLivestream, selectUserProfile, } from "features/bluesky/blueskySlice"; -import { useAppDispatch, useAppSelector } from "store/hooks"; -import { useLiveUser } from "hooks/useLiveUser"; -import ThumbnailSelector from "components/thumbnail-selector"; import { useCaptureVideoFrame } from "hooks/useCaptureVideoFrame"; -import { useWindowDimensions, ScrollView } from "react-native"; +import { useLiveUser } from "hooks/useLiveUser"; +import { useEffect, useState } from "react"; +import { ScrollView, useWindowDimensions } from "react-native"; +import { useAppDispatch, useAppSelector } from "store/hooks"; +import { Button, Label, Paragraph, TextArea, View, isWeb } from "tamagui"; export default function CreateLivestream() { const dispatch = useAppDispatch(); diff --git a/js/app/components/debug/breakpoint-indicator.tsx b/js/app/components/debug/breakpoint-indicator.tsx index 70a16938e..f9e029afa 100644 --- a/js/app/components/debug/breakpoint-indicator.tsx +++ b/js/app/components/debug/breakpoint-indicator.tsx @@ -1,5 +1,4 @@ -import { Text, View } from "tamagui"; -import { useMedia } from "tamagui"; +import { Text, useMedia, View } from "tamagui"; export default function BreakpointIndicator() { const media = useMedia(); diff --git a/js/app/components/edit-livestream.tsx b/js/app/components/edit-livestream.tsx index 0e1efa0a6..1690e02d0 100644 --- a/js/app/components/edit-livestream.tsx +++ b/js/app/components/edit-livestream.tsx @@ -1,14 +1,14 @@ -import { useEffect, useState } from "react"; -import { Button, H3, Label, Paragraph, Text, TextArea, View } from "tamagui"; import { useToastController } from "@tamagui/toast"; import { selectNewLivestream, selectUserProfile, updateLivestreamRecord, } from "features/bluesky/blueskySlice"; -import { useAppDispatch, useAppSelector } from "store/hooks"; import { useLiveUser } from "hooks/useLiveUser"; +import { useEffect, useState } from "react"; import { ScrollView } from "react-native"; +import { useAppDispatch, useAppSelector } from "store/hooks"; +import { Button, H3, Label, Paragraph, Text, TextArea, View } from "tamagui"; export default function UpdateLivestream({ playerId, diff --git a/js/app/components/emoji-picker/emoji-picker.tsx b/js/app/components/emoji-picker/emoji-picker.tsx index 8b5f35518..a23dfd7a2 100644 --- a/js/app/components/emoji-picker/emoji-picker.tsx +++ b/js/app/components/emoji-picker/emoji-picker.tsx @@ -1,7 +1,6 @@ import Picker from "@emoji-mart/react"; +import { isWeb, View } from "tamagui"; import { emojiEmitter } from "./emoji-emitter"; -import { View } from "tamagui"; -import { isWeb } from "tamagui"; export type Emoji = { native: string; diff --git a/js/app/components/error/error.tsx b/js/app/components/error/error.tsx index 3823cf5bc..2d7418f3a 100644 --- a/js/app/components/error/error.tsx +++ b/js/app/components/error/error.tsx @@ -1,4 +1,4 @@ -import { View, Text, Button } from "tamagui"; +import { Button, Text, View } from "tamagui"; export default function (props: { onRetry: () => void }) { return ( diff --git a/js/app/components/follow-button.tsx b/js/app/components/follow-button.tsx index 9e1c15d72..f7e42f23d 100644 --- a/js/app/components/follow-button.tsx +++ b/js/app/components/follow-button.tsx @@ -1,9 +1,9 @@ +import { Check, Plus } from "@tamagui/lucide-icons"; import React, { useEffect, useState } from "react"; -import { useAppDispatch, useAppSelector } from "../store/hooks"; -import { selectStreamplace } from "../features/streamplace/streamplaceSlice"; +import { Button, Text, View } from "tamagui"; import { followUser, unfollowUser } from "../features/bluesky/blueskySlice"; -import { Button, View, Text } from "tamagui"; -import { Plus, Check } from "@tamagui/lucide-icons"; +import { selectStreamplace } from "../features/streamplace/streamplaceSlice"; +import { useAppDispatch, useAppSelector } from "../store/hooks"; /** * FollowButton component for following/unfollowing a streamer. diff --git a/js/app/components/get-apps.tsx b/js/app/components/get-apps.tsx index edc31764b..1bdc5cdd5 100644 --- a/js/app/components/get-apps.tsx +++ b/js/app/components/get-apps.tsx @@ -1,4 +1,4 @@ -import { XStack, Image, Anchor } from "tamagui"; +import { Anchor, Image, XStack } from "tamagui"; const RATIO = 3.39741547176; const WIDTH = 200; diff --git a/js/app/components/home/cards.tsx b/js/app/components/home/cards.tsx index f48ba0866..3ef1c9ba0 100644 --- a/js/app/components/home/cards.tsx +++ b/js/app/components/home/cards.tsx @@ -1,7 +1,7 @@ -import { Image } from "react-native"; -import { Stack, Text, XStack, YStack, isWeb, useMedia, View } from "tamagui"; import Viewers from "components/viewers"; import useStreamplaceNode from "hooks/useStreamplaceNode"; +import { Image } from "react-native"; +import { isWeb, Stack, Text, useMedia, View, XStack, YStack } from "tamagui"; export type StreamCardSize = "xs" | "sm" | "md" | "lg" | "xl"; diff --git a/js/app/components/home/live-dot.tsx b/js/app/components/home/live-dot.tsx index 514ca0fde..09ea36eac 100644 --- a/js/app/components/home/live-dot.tsx +++ b/js/app/components/home/live-dot.tsx @@ -1,10 +1,10 @@ -import React, { useEffect } from "react"; +import { useEffect } from "react"; import { StyleSheet, View } from "react-native"; import Animated, { - useSharedValue, useAnimatedStyle, - withTiming, + useSharedValue, withRepeat, + withTiming, } from "react-native-reanimated"; export default function LiveDot() { diff --git a/js/app/components/index.tsx b/js/app/components/index.tsx index cc819c5c9..bd96a257c 100644 --- a/js/app/components/index.tsx +++ b/js/app/components/index.tsx @@ -1,4 +1,4 @@ export { Countdown } from "./countdown"; export { Player } from "./player/player"; -export { Settings } from "./settings/settings"; export { default as Provider } from "./provider/provider"; +export { Settings } from "./settings/settings"; diff --git a/js/app/components/live-dashboard/stream-key.tsx b/js/app/components/live-dashboard/stream-key.tsx index 37c87eba1..8fe209556 100644 --- a/js/app/components/live-dashboard/stream-key.tsx +++ b/js/app/components/live-dashboard/stream-key.tsx @@ -1,15 +1,15 @@ import { useToastController } from "@tamagui/toast"; +import { Redirect } from "components/aqlink"; import Loading from "components/loading/loading"; import { clearStreamKeyRecord, createStreamKeyRecord, - selectUserProfile, selectIsReady, + selectUserProfile, } from "features/bluesky/blueskySlice"; import { useEffect, useState } from "react"; import { useAppDispatch, useAppSelector } from "store/hooks"; -import { View, Paragraph, Button, Text } from "tamagui"; -import { Redirect } from "components/aqlink"; +import { Button, Paragraph, Text, View } from "tamagui"; const Row = ({ children }: { children: React.ReactNode }) => { return ( diff --git a/js/app/components/live-dashboard/waiting.tsx b/js/app/components/live-dashboard/waiting.tsx index 95569ea77..d227009ca 100644 --- a/js/app/components/live-dashboard/waiting.tsx +++ b/js/app/components/live-dashboard/waiting.tsx @@ -1,5 +1,5 @@ import Loading from "components/loading/loading"; -import { View, Text } from "tamagui"; +import { Text, View } from "tamagui"; export default function Waiting() { return ( diff --git a/js/app/components/livestream/livestream.tsx b/js/app/components/livestream/livestream.tsx index 9366d78f2..4b5c1794d 100644 --- a/js/app/components/livestream/livestream.tsx +++ b/js/app/components/livestream/livestream.tsx @@ -1,12 +1,17 @@ +import { MessageCircleMore, MessageCircleOff } from "@tamagui/lucide-icons"; +import { useToastController } from "@tamagui/toast"; import Chat from "components/chat/chat"; import ChatBox from "components/chat/chat-box"; +import FollowButton from "components/follow-button"; import Loading from "components/loading/loading"; import { Player } from "components/player/player"; import { PlayerProps } from "components/player/props"; import PlayerProvider from "components/player/provider"; import Popup from "components/popup"; -import Viewers from "components/viewers"; import Timer from "components/timer"; +import Viewers from "components/viewers"; +import { useFullscreen } from "contexts/FullscreenContext"; +import { getProfile, selectProfiles } from "features/bluesky/blueskySlice"; import { usePlayer } from "features/player/playerSlice"; import { selectTelemetry, @@ -17,10 +22,11 @@ import usePlatform from "hooks/usePlatform"; import { useCallback, useEffect, useState } from "react"; import { LayoutChangeEvent, + Linking, View as RNView, SafeAreaView, - Linking, } from "react-native"; +import storage from "storage"; import { useAppDispatch, useAppSelector } from "store/hooks"; import { Button, @@ -31,12 +37,6 @@ import { useWindowDimensions, View, } from "tamagui"; -import { MessageCircleOff, MessageCircleMore } from "@tamagui/lucide-icons"; -import FollowButton from "components/follow-button"; -import { useToastController } from "@tamagui/toast"; -import { selectProfiles, getProfile } from "features/bluesky/blueskySlice"; -import storage from "storage"; -import { useFullscreen } from "contexts/FullscreenContext"; export default function Livestream(props: Partial) { return ( diff --git a/js/app/components/loading/loading.tsx b/js/app/components/loading/loading.tsx index ae7b6af6e..f60bbdb79 100644 --- a/js/app/components/loading/loading.tsx +++ b/js/app/components/loading/loading.tsx @@ -1,4 +1,4 @@ -import { View, Spinner as TamaguiSpinner } from "tamagui"; +import { Spinner as TamaguiSpinner, View } from "tamagui"; export default function () { return ( diff --git a/js/app/components/login/login.tsx b/js/app/components/login/login.tsx index 4ba7a6f3d..821ec0c1b 100644 --- a/js/app/components/login/login.tsx +++ b/js/app/components/login/login.tsx @@ -1,4 +1,7 @@ -import { AtpBaseClient } from "streamplace"; +import { useNavigation } from "@react-navigation/native"; +import { CircleHelp } from "@tamagui/lucide-icons"; +import { useToastController } from "@tamagui/toast"; +import Loading from "components/loading/loading"; import NameColorPicker from "components/name-color-picker/name-color-picker"; import { login, @@ -21,10 +24,6 @@ import { XStack, YStack, } from "tamagui"; -import Loading from "components/loading/loading"; -import { useToastController } from "@tamagui/toast"; -import { useNavigation } from "@react-navigation/native"; -import { CircleHelp } from "@tamagui/lucide-icons"; export default function Login() { const dispatch = useAppDispatch(); diff --git a/js/app/components/login/signup.tsx b/js/app/components/login/signup.tsx index e9983d0b9..c0b1d9116 100644 --- a/js/app/components/login/signup.tsx +++ b/js/app/components/login/signup.tsx @@ -1,3 +1,7 @@ +import { useNavigation } from "@react-navigation/native"; +import { CircleHelp } from "@tamagui/lucide-icons"; +import { useToastController } from "@tamagui/toast"; +import Loading from "components/loading/loading"; import { login, selectIsReady, @@ -17,10 +21,6 @@ import { XStack, YStack, } from "tamagui"; -import Loading from "components/loading/loading"; -import { useToastController } from "@tamagui/toast"; -import { useNavigation } from "@react-navigation/native"; -import { CircleHelp } from "@tamagui/lucide-icons"; export default function SignUp() { const dispatch = useAppDispatch(); diff --git a/js/app/components/name-color-picker/name-color-picker.tsx b/js/app/components/name-color-picker/name-color-picker.tsx index 474fc07cc..6a15f62e0 100644 --- a/js/app/components/name-color-picker/name-color-picker.tsx +++ b/js/app/components/name-color-picker/name-color-picker.tsx @@ -5,7 +5,6 @@ import { selectChatProfile, selectUserProfile, } from "features/bluesky/blueskySlice"; -import { PlaceStreamChatProfile } from "streamplace"; import { useEffect, useState } from "react"; import { Keyboard } from "react-native"; import ColorPicker, { @@ -15,6 +14,7 @@ import ColorPicker, { Swatches, } from "reanimated-color-picker"; import { useAppDispatch, useAppSelector } from "store/hooks"; +import { PlaceStreamChatProfile } from "streamplace"; import { Button, H3, isWeb, Sheet, useTheme, View } from "tamagui"; /** diff --git a/js/app/components/player/controls.tsx b/js/app/components/player/controls.tsx index 39402ec42..6d8c37fea 100644 --- a/js/app/components/player/controls.tsx +++ b/js/app/components/player/controls.tsx @@ -13,49 +13,49 @@ import { Volume2, VolumeX, } from "@tamagui/lucide-icons"; +import { Countdown } from "components/countdown"; +import Loading from "components/loading/loading"; +import Viewers from "components/viewers"; +import { + usePlayer, + usePlayerActions, + usePlayerProtocol, + usePlayerRenditions, + usePlayerSegment, + usePlayerSelectedRendition, +} from "features/player/playerSlice"; +import { userMute } from "features/streamplace/streamplaceSlice"; +import usePlatform from "hooks/usePlatform"; import { Dispatch, Fragment, + useCallback, useEffect, useRef, useState, - useCallback, } from "react"; -import { Animated, Pressable, Easing } from "react-native"; +import { Animated, Easing, Pressable } from "react-native"; +import { useAppDispatch, useAppSelector } from "store/hooks"; +import { PlaceStreamDefs } from "streamplace"; import { + Adapt, Button, + H1, H3, + H5, + Image, ListItem, + Paragraph, Popover, Separator, + Slider, Text, useMedia, View, XStack, YGroup, - H1, - H5, - Paragraph, - Slider, - Adapt, } from "tamagui"; import { PlayerProps, PROTOCOL_HLS, PROTOCOL_WEBRTC } from "./props"; -import { - usePlayer, - usePlayerActions, - usePlayerProtocol, - usePlayerRenditions, - usePlayerSegment, - usePlayerSelectedRendition, -} from "features/player/playerSlice"; -import { useAppDispatch, useAppSelector } from "store/hooks"; -import Loading from "components/loading/loading"; -import Viewers from "components/viewers"; -import { userMute } from "features/streamplace/streamplaceSlice"; -import { Countdown } from "components/countdown"; -import { PlaceStreamDefs } from "streamplace"; -import usePlatform from "hooks/usePlatform"; -import { Image } from "tamagui"; const Bar = (props) => ( ; diff --git a/js/app/components/player/video.tsx b/js/app/components/player/video.tsx index beb30a944..ad6fc6e56 100644 --- a/js/app/components/player/video.tsx +++ b/js/app/components/player/video.tsx @@ -6,7 +6,6 @@ import useStreamplaceNode from "hooks/useStreamplaceNode"; import { ForwardedRef, forwardRef, - RefObject, useCallback, useEffect, useRef, diff --git a/js/app/components/popup.tsx b/js/app/components/popup.tsx index 76fff633a..9f6871b26 100644 --- a/js/app/components/popup.tsx +++ b/js/app/components/popup.tsx @@ -1,5 +1,5 @@ import { X } from "@tamagui/lucide-icons"; -import { View, Button, ViewProps } from "tamagui"; +import { Button, View, ViewProps } from "tamagui"; export default function Popup({ onClose, diff --git a/js/app/components/provider/provider.shared.tsx b/js/app/components/provider/provider.shared.tsx index 90e63d92c..ad8c9e9e5 100644 --- a/js/app/components/provider/provider.shared.tsx +++ b/js/app/components/provider/provider.shared.tsx @@ -5,14 +5,14 @@ import { } from "@react-navigation/native"; import { ToastProvider, ToastViewport } from "@tamagui/toast"; import { useFonts } from "expo-font"; +import BlueskyProvider from "features/bluesky/blueskyProvider"; import StreamplaceProvider from "features/streamplace/streamplaceProvider"; import React from "react"; +import { Provider as ReduxProvider } from "react-redux"; +import { store } from "store/store"; import { PortalProvider, TamaguiProvider } from "tamagui"; import config from "tamagui.config"; import { CurrentToast } from "./CurrentToast"; -import { Provider as ReduxProvider } from "react-redux"; -import BlueskyProvider from "features/bluesky/blueskyProvider"; -import { store } from "store/store"; export default function Provider({ children, linking, diff --git a/js/app/components/provider/provider.tsx b/js/app/components/provider/provider.tsx index 934bfe035..05586bdf2 100644 --- a/js/app/components/provider/provider.tsx +++ b/js/app/components/provider/provider.tsx @@ -2,9 +2,9 @@ import "@rainbow-me/rainbowkit/styles.css"; import { LinkingOptions } from "@react-navigation/native"; -import SharedProvider from "./provider.shared"; -import React, { useEffect } from "react"; import { WalletProvider } from "hooks/useWallet"; +import React, { useEffect } from "react"; +import SharedProvider from "./provider.shared"; export default function Provider({ children, diff --git a/js/app/components/settings/settings.tsx b/js/app/components/settings/settings.tsx index 5d5589ffd..856d1a68a 100644 --- a/js/app/components/settings/settings.tsx +++ b/js/app/components/settings/settings.tsx @@ -1,15 +1,15 @@ import { + DEFAULT_URL, selectTelemetry, setURL, telemetryOpt, - DEFAULT_URL, } from "features/streamplace/streamplaceSlice"; import useStreamplaceNode from "hooks/useStreamplaceNode"; -import { useState, useEffect } from "react"; +import { useEffect, useState } from "react"; +import { Switch } from "react-native"; import { useAppDispatch, useAppSelector } from "store/hooks"; -import { Button, Form, H3, Input, View, XStack, Text, isWeb } from "tamagui"; +import { Button, Form, H3, Input, Text, View, XStack, isWeb } from "tamagui"; import { Updates } from "./updates"; -import { Switch } from "react-native"; export function Settings() { const dispatch = useAppDispatch(); diff --git a/js/app/components/settings/updates.native.tsx b/js/app/components/settings/updates.native.tsx index 53b666822..c771f65fc 100644 --- a/js/app/components/settings/updates.native.tsx +++ b/js/app/components/settings/updates.native.tsx @@ -1,9 +1,9 @@ +import { ToastViewport, useToastController } from "@tamagui/toast"; import * as ExpoUpdates from "expo-updates"; import { useEffect, useState } from "react"; +import { Platform } from "react-native"; import { Button, H2, H5, Text, View } from "tamagui"; -import { ToastViewport, useToastController } from "@tamagui/toast"; import pkg from "../../package.json"; -import { Platform } from "react-native"; export function Updates() { const version = pkg.version; diff --git a/js/app/components/settings/updates.tsx b/js/app/components/settings/updates.tsx index 2655be4f4..7e0544702 100644 --- a/js/app/components/settings/updates.tsx +++ b/js/app/components/settings/updates.tsx @@ -1,5 +1,5 @@ +import { H2, View } from "tamagui"; import pkg from "../../package.json"; -import { View, H2 } from "tamagui"; // maybe someday some PWA update stuff will live here export function Updates() { diff --git a/js/app/components/sidebar/sidebar-item.tsx b/js/app/components/sidebar/sidebar-item.tsx index 767ee5e24..ce537fbb6 100644 --- a/js/app/components/sidebar/sidebar-item.tsx +++ b/js/app/components/sidebar/sidebar-item.tsx @@ -1,8 +1,8 @@ import { FileQuestion } from "@tamagui/lucide-icons"; -import { Text, View, AnimatePresence } from "tamagui"; -import { Pressable } from "react-native-gesture-handler"; import { ReactNode, useState } from "react"; import { PressableStateCallbackType, StyleProp, ViewStyle } from "react-native"; +import { Pressable } from "react-native-gesture-handler"; +import { AnimatePresence, Text, View } from "tamagui"; export default function SidebarItem({ icon, diff --git a/js/app/components/sidebar/sidebar.tsx b/js/app/components/sidebar/sidebar.tsx index ebecc3ad8..1166a7189 100644 --- a/js/app/components/sidebar/sidebar.tsx +++ b/js/app/components/sidebar/sidebar.tsx @@ -1,15 +1,15 @@ -import { YStack, styled, Text, View, Image } from "tamagui"; -import { SharedValue, useAnimatedStyle } from "react-native-reanimated"; -import SidebarItem from "./sidebar-item"; +import { DrawerNavigationOptions } from "@react-navigation/drawer"; +import { DrawerDescriptorMap } from "@react-navigation/drawer/lib/typescript/src/types"; import { CommonActions, DrawerNavigationState, ParamListBase, } from "@react-navigation/native"; -import { DrawerNavigationOptions } from "@react-navigation/drawer"; -import { DrawerDescriptorMap } from "@react-navigation/drawer/lib/typescript/src/types"; -import { Platform } from "react-native"; import { FileQuestion } from "@tamagui/lucide-icons"; +import { Platform } from "react-native"; +import { SharedValue, useAnimatedStyle } from "react-native-reanimated"; +import { Image, styled, Text, View, YStack } from "tamagui"; +import SidebarItem from "./sidebar-item"; const AnimatedYStack = styled(YStack, { name: "AnimatedYStack", diff --git a/js/app/components/thumbnail-selector/thumbnail-selector.tsx b/js/app/components/thumbnail-selector/thumbnail-selector.tsx index ca408311f..f69b55710 100644 --- a/js/app/components/thumbnail-selector/thumbnail-selector.tsx +++ b/js/app/components/thumbnail-selector/thumbnail-selector.tsx @@ -1,6 +1,6 @@ +import { Camera, Image as ImageIcon, X } from "@tamagui/lucide-icons"; import { useCallback, useEffect, useRef, useState } from "react"; import { Button, Image, Text, View, isWeb } from "tamagui"; -import { Camera, Image as ImageIcon, X } from "@tamagui/lucide-icons"; import { ThumbnailSelectorProps } from "./shared"; export default function ThumbnailSelector({ diff --git a/js/app/components/timer.tsx b/js/app/components/timer.tsx index d496b4614..4bd2ea24c 100644 --- a/js/app/components/timer.tsx +++ b/js/app/components/timer.tsx @@ -1,5 +1,5 @@ -import { View, Text } from "tamagui"; -import { useState, useEffect } from "react"; +import { useEffect, useState } from "react"; +import { Text, View } from "tamagui"; export default function Timer({ start }: { start: string | Date }) { const [elapsedTime, setElapsedTime] = useState(0); diff --git a/js/app/components/ui/button-selector.tsx b/js/app/components/ui/button-selector.tsx index 177780252..e24c928ca 100644 --- a/js/app/components/ui/button-selector.tsx +++ b/js/app/components/ui/button-selector.tsx @@ -1,4 +1,4 @@ -import { YStack, XStack, Text, Button, View, YStackProps } from "tamagui"; +import { Button, Text, XStack, YStack, YStackProps } from "tamagui"; export default function ButtonSelector({ text, diff --git a/js/app/components/viewers.tsx b/js/app/components/viewers.tsx index 7d72635ff..dc8249b85 100644 --- a/js/app/components/viewers.tsx +++ b/js/app/components/viewers.tsx @@ -1,5 +1,5 @@ import { User } from "@tamagui/lucide-icons"; -import { View, Text } from "tamagui"; +import { Text, View } from "tamagui"; export default function Viewers({ viewers }: { viewers: number }) { return ( diff --git a/js/app/contexts/FullscreenContext.tsx b/js/app/contexts/FullscreenContext.tsx index 4fbb979fb..5dcdfaf75 100644 --- a/js/app/contexts/FullscreenContext.tsx +++ b/js/app/contexts/FullscreenContext.tsx @@ -4,10 +4,10 @@ import { } from "features/base/sidebarSlice"; import { createContext, - useContext, - useState, ReactNode, + useContext, useEffect, + useState, } from "react"; import { useDispatch } from "react-redux"; diff --git a/js/app/contexts/VideoElementContext.tsx b/js/app/contexts/VideoElementContext.tsx index 2e21db925..c0ee832a1 100644 --- a/js/app/contexts/VideoElementContext.tsx +++ b/js/app/contexts/VideoElementContext.tsx @@ -1,4 +1,4 @@ -import React, { createContext, useContext, ReactNode } from "react"; +import { createContext, ReactNode, useContext } from "react"; interface VideoElementContextType { videoElement: HTMLVideoElement | null; diff --git a/js/app/features/bluesky/agent.tsx b/js/app/features/bluesky/agent.tsx index b56daf813..3c7b03f8d 100644 --- a/js/app/features/bluesky/agent.tsx +++ b/js/app/features/bluesky/agent.tsx @@ -1,9 +1,8 @@ import { Agent } from "@atproto/api"; -import { SessionManager } from "@atproto/api/dist/session-manager"; -import { PlaceNS } from "streamplace"; import { schemas as parentSchemas } from "@atproto/api/dist/client/lexicons"; -import { schemas as appSchemas } from "streamplace"; +import { SessionManager } from "@atproto/api/dist/session-manager"; import { Lexicons } from "@atproto/lexicon"; +import { schemas as appSchemas, PlaceNS } from "streamplace"; export class StreamplaceAgent extends Agent { place = new PlaceNS(this); lex: Lexicons; diff --git a/js/app/features/bluesky/blueskyProvider.tsx b/js/app/features/bluesky/blueskyProvider.tsx index e219d1761..c11c85e24 100644 --- a/js/app/features/bluesky/blueskyProvider.tsx +++ b/js/app/features/bluesky/blueskyProvider.tsx @@ -6,7 +6,6 @@ import { getProfile, loadOAuthClient, oauthCallback, - oauthError, selectIsReady, selectOAuthSession, selectUserProfile, diff --git a/js/app/features/bluesky/blueskyTypes.tsx b/js/app/features/bluesky/blueskyTypes.tsx index bae771ddc..e9d2a4bb6 100644 --- a/js/app/features/bluesky/blueskyTypes.tsx +++ b/js/app/features/bluesky/blueskyTypes.tsx @@ -1,9 +1,9 @@ -import { OAuthSession } from "@streamplace/atproto-oauth-client-react-native"; import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; +import { OAuthSession } from "@streamplace/atproto-oauth-client-react-native"; import { StreamKey } from "features/base/baseSlice"; import { PlaceStreamChatProfile, PlaceStreamLivestream } from "streamplace"; -import { StreamplaceOAuthClient } from "./oauthClient"; import { StreamplaceAgent } from "./agent"; +import { StreamplaceOAuthClient } from "./oauthClient"; type NewLivestream = { loading: boolean; diff --git a/js/app/features/platform/platformSlice.native.tsx b/js/app/features/platform/platformSlice.native.tsx index 0a3190bd2..e763b74d5 100644 --- a/js/app/features/platform/platformSlice.native.tsx +++ b/js/app/features/platform/platformSlice.native.tsx @@ -1,14 +1,14 @@ +import messaging from "@react-native-firebase/messaging"; import { openAuthSessionAsync } from "expo-web-browser"; +import { oauthCallback } from "features/bluesky/blueskySlice"; +import { BlueskyState } from "features/bluesky/blueskyTypes"; +import { PermissionsAndroid, Platform } from "react-native"; import { createAppSlice } from "../../hooks/createSlice"; -import messaging from "@react-native-firebase/messaging"; -import { Platform, PermissionsAndroid } from "react-native"; import { initialState, - RegisterNotificationTokenBody, PlatformState, + RegisterNotificationTokenBody, } from "./shared"; -import { BlueskyState } from "features/bluesky/blueskyTypes"; -import { oauthCallback } from "features/bluesky/blueskySlice"; const checkApplicationPermission = async () => { if (Platform.OS === "android") { diff --git a/js/app/features/player/playerSlice.tsx b/js/app/features/player/playerSlice.tsx index 7c3d574ef..d78746c8a 100644 --- a/js/app/features/player/playerSlice.tsx +++ b/js/app/features/player/playerSlice.tsx @@ -4,15 +4,15 @@ import { PROTOCOL_HLS, PROTOCOL_WEBRTC } from "components/player/props"; import { StreamplaceState } from "features/streamplace/streamplaceSlice"; import { uuidv7 } from "hooks/uuid"; import { createContext, useContext } from "react"; -import { createAppSlice } from "../../hooks/createSlice"; +import { useAppDispatch } from "store/hooks"; import { - PlaceStreamSegment, - PlaceStreamLivestream, - PlaceStreamDefs, PlaceStreamChatDefs, PlaceStreamChatMessage, + PlaceStreamDefs, + PlaceStreamLivestream, + PlaceStreamSegment, } from "streamplace"; -import { useAppDispatch } from "store/hooks"; +import { createAppSlice } from "../../hooks/createSlice"; export interface PlayerContextType { playerId: string | null; diff --git a/js/app/features/streamplace/streamplaceProvider.tsx b/js/app/features/streamplace/streamplaceProvider.tsx index 75213a0fd..9dfd1c6ca 100644 --- a/js/app/features/streamplace/streamplaceProvider.tsx +++ b/js/app/features/streamplace/streamplaceProvider.tsx @@ -1,8 +1,8 @@ +import Loading from "components/loading/loading"; import { createContext, useEffect } from "react"; -import { DEFAULT_URL, initialize, selectStreamplace } from "./streamplaceSlice"; import { useAppDispatch, useAppSelector } from "store/hooks"; -import Loading from "components/loading/loading"; -import { View, Text } from "tamagui"; +import { Text, View } from "tamagui"; +import { DEFAULT_URL, initialize, selectStreamplace } from "./streamplaceSlice"; export const StreamplaceContext = createContext({ url: DEFAULT_URL, diff --git a/js/app/features/streamplace/streamplaceSlice.tsx b/js/app/features/streamplace/streamplaceSlice.tsx index 0dcdb3bd0..88ef9f48f 100644 --- a/js/app/features/streamplace/streamplaceSlice.tsx +++ b/js/app/features/streamplace/streamplaceSlice.tsx @@ -1,9 +1,8 @@ +import { BlueskyState } from "features/bluesky/blueskyTypes"; +import { PlaceStreamLivestream, PlaceStreamSegment } from "streamplace"; import { isWeb } from "tamagui"; import { createAppSlice } from "../../hooks/createSlice"; import Storage from "../../storage"; -import { BlueskyState } from "features/bluesky/blueskyTypes"; -import { PlaceStreamSegment, PlaceStreamLivestream } from "streamplace"; -import { StreamplaceAgent } from "features/bluesky/agent"; let DEFAULT_URL = process.env.EXPO_PUBLIC_STREAMPLACE_URL as string; if (isWeb && process.env.EXPO_PUBLIC_WEB_TRY_LOCAL === "true") { diff --git a/js/app/hooks/useAvatars.tsx b/js/app/hooks/useAvatars.tsx index 679265da2..7a6f63762 100644 --- a/js/app/hooks/useAvatars.tsx +++ b/js/app/hooks/useAvatars.tsx @@ -1,10 +1,10 @@ -import { useEffect, useMemo } from "react"; import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; -import { useAppSelector, useAppDispatch } from "store/hooks"; import { - selectCachedProfiles, getProfiles, + selectCachedProfiles, } from "features/bluesky/blueskySlice"; +import { useEffect, useMemo } from "react"; +import { useAppDispatch, useAppSelector } from "store/hooks"; // Hack: Easy way to cache and get avatars export default function useAvatars(dids: string[]) { diff --git a/js/app/hooks/useCaptureVideoFrame.ts b/js/app/hooks/useCaptureVideoFrame.ts index 87e414b95..5e2c4f2ac 100644 --- a/js/app/hooks/useCaptureVideoFrame.ts +++ b/js/app/hooks/useCaptureVideoFrame.ts @@ -1,6 +1,6 @@ +import { useVideoElement } from "contexts/VideoElementContext"; import { useCallback } from "react"; import { isWeb } from "tamagui"; -import { useVideoElement } from "contexts/VideoElementContext"; import { captureVideoFrame } from "utils/videoCapture"; /** diff --git a/js/app/hooks/usePreloadEmoji.ts b/js/app/hooks/usePreloadEmoji.ts index fd0b3949b..0e5fd2904 100644 --- a/js/app/hooks/usePreloadEmoji.ts +++ b/js/app/hooks/usePreloadEmoji.ts @@ -1,5 +1,5 @@ -import React from "react"; import { init } from "emoji-mart"; +import React from "react"; import { isWeb } from "tamagui"; let loadRequested = false; diff --git a/js/app/hooks/useSidebarControl.tsx b/js/app/hooks/useSidebarControl.tsx index 5c9771d1d..531551a5a 100644 --- a/js/app/hooks/useSidebarControl.tsx +++ b/js/app/hooks/useSidebarControl.tsx @@ -4,14 +4,14 @@ import { useSharedValue, withTiming, } from "react-native-reanimated"; -import { useWindowDimensions } from "tamagui"; import { useDispatch, useSelector } from "react-redux"; +import { useWindowDimensions } from "tamagui"; import { - toggleSidebar, selectIsSidebarCollapsed, - selectSidebarTargetWidth, selectIsSidebarHidden, + selectSidebarTargetWidth, + toggleSidebar, } from "../features/base/sidebarSlice"; import { RootState } from "../store/store"; diff --git a/js/app/hooks/useWallet.shared.tsx b/js/app/hooks/useWallet.shared.tsx index 629e1f9af..33fb6c7fe 100644 --- a/js/app/hooks/useWallet.shared.tsx +++ b/js/app/hooks/useWallet.shared.tsx @@ -1,4 +1,4 @@ -import { TypedData, SignTypedDataParameters } from "viem"; +import { SignTypedDataParameters, TypedData } from "viem"; export type SignTypedDataFn = < const typedData extends TypedData | { [key: string]: unknown }, diff --git a/js/app/hooks/useWallet.tsx b/js/app/hooks/useWallet.tsx index 8e1474a60..6ac86ccbe 100644 --- a/js/app/hooks/useWallet.tsx +++ b/js/app/hooks/useWallet.tsx @@ -1,21 +1,20 @@ -import { createContext, useContext, useEffect, useState } from "react"; -import { createWalletClient, http } from "viem"; -import usePlatform from "./usePlatform"; import { ConnectButton, getDefaultConfig, RainbowKitProvider, } from "@rainbow-me/rainbowkit"; -import React from "react"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import React, { createContext, useContext, useEffect, useState } from "react"; import { View as RNView, View } from "react-native"; +import { Paragraph } from "tamagui"; +import { createWalletClient, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { arbitrum, base, mainnet, optimism, polygon } from "viem/chains"; -import { Paragraph } from "tamagui"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import usePlatform from "./usePlatform"; import { notActiveWallet, - WalletStuff, SignTypedDataFn, + WalletStuff, } from "./useWallet.shared"; const WalletContext = createContext(notActiveWallet); diff --git a/js/app/src/entrypoint.tsx b/js/app/src/entrypoint.tsx index 73e7634cb..67e583e92 100644 --- a/js/app/src/entrypoint.tsx +++ b/js/app/src/entrypoint.tsx @@ -2,8 +2,8 @@ // hot module reloading works properly on web. import "@expo/metro-runtime"; +import { registerRootComponent } from "expo"; import "./polyfills"; import Router from "./router"; -import { registerRootComponent } from "expo"; registerRootComponent(Router); diff --git a/js/app/src/router.tsx b/js/app/src/router.tsx index 39e8c79f9..e883d7004 100644 --- a/js/app/src/router.tsx +++ b/js/app/src/router.tsx @@ -16,25 +16,42 @@ import { import { createNativeStackNavigator } from "@react-navigation/native-stack"; import { ArrowLeft, + Book, + Download, + ExternalLink, Home, LogIn, Menu, + Notebook, + PanelLeftClose, + PanelLeftOpen, Settings as SettingsIcon, - User, ShieldQuestion, - Download, + User, Video, - PanelLeftOpen, - PanelLeftClose, - Book, - ExternalLink, - Notebook, } from "@tamagui/lucide-icons"; +import { useToastController } from "@tamagui/toast"; import { Provider, Settings } from "components"; import AQLink from "components/aqlink"; import Login from "components/login/login"; +import Popup from "components/popup"; +import Sidebar, { ExternalDrawerItem } from "components/sidebar/sidebar"; +import { hydrate, selectHydrated } from "features/base/baseSlice"; import { selectUserProfile } from "features/bluesky/blueskySlice"; +import { + clearNotification, + initPushNotifications, + registerNotificationToken, + selectNotificationDestination, + selectNotificationToken, +} from "features/platform/platformSlice.native"; +import { + pollMySegments, + pollSegments, +} from "features/streamplace/streamplaceSlice"; +import { useLiveUser } from "hooks/useLiveUser"; import usePlatform from "hooks/usePlatform"; +import { useSidebarControl } from "hooks/useSidebarControl"; import { ReactElement, useEffect, useState } from "react"; import { ImageBackground, @@ -45,40 +62,23 @@ import { StatusBar, } from "react-native"; import { useAppDispatch, useAppSelector } from "store/hooks"; -import { useTheme, Text, View, H3 } from "tamagui"; -import AppReturnScreen from "./screens/app-return"; -import MultiScreen from "./screens/multi"; -import StreamScreen from "./screens/stream"; -import SupportScreen from "./screens/support"; +import { H3, Text, useTheme, View } from "tamagui"; import AboutScreen from "./screens/about"; -import DownloadScreen from "./screens/download"; -import { hydrate, selectHydrated } from "features/base/baseSlice"; +import AppReturnScreen from "./screens/app-return"; import AVSyncScreen from "./screens/av-sync"; -import { - clearNotification, - initPushNotifications, - registerNotificationToken, - selectNotificationDestination, - selectNotificationToken, -} from "features/platform/platformSlice.native"; -import { - pollMySegments, - pollSegments, -} from "features/streamplace/streamplaceSlice"; -import { useLiveUser } from "hooks/useLiveUser"; -import { useToastController } from "@tamagui/toast"; -import LiveDashboard from "./screens/live-dashboard"; -import Popup from "components/popup"; import PopoutChat from "./screens/chat-popout"; +import DownloadScreen from "./screens/download"; import EmbedScreen from "./screens/embed"; -import { useSidebarControl } from "hooks/useSidebarControl"; -import Sidebar, { ExternalDrawerItem } from "components/sidebar/sidebar"; +import LiveDashboard from "./screens/live-dashboard"; +import MultiScreen from "./screens/multi"; +import StreamScreen from "./screens/stream"; +import SupportScreen from "./screens/support"; // probabl should move this -import { store } from "store/store"; +import SignUp from "components/login/signup"; import { loadStateFromStorage } from "features/base/sidebarSlice"; +import { store } from "store/store"; import HomeScreen from "./screens/home"; -import SignUp from "components/login/signup"; store.dispatch(loadStateFromStorage()); diff --git a/js/app/src/screens/about.tsx b/js/app/src/screens/about.tsx index d96745253..6f07d1da8 100644 --- a/js/app/src/screens/about.tsx +++ b/js/app/src/screens/about.tsx @@ -1,4 +1,4 @@ -import { H4 as TamaguiH4, Paragraph, View, Anchor } from "tamagui"; +import { Anchor, Paragraph, H4 as TamaguiH4, View } from "tamagui"; const H4 = (props: any) => ; const P = (props: any) => ( diff --git a/js/app/src/screens/av-sync.tsx b/js/app/src/screens/av-sync.tsx index f83d8f0b2..c4e52c7d0 100644 --- a/js/app/src/screens/av-sync.tsx +++ b/js/app/src/screens/av-sync.tsx @@ -1,9 +1,9 @@ -import { useEffect, useRef } from "react"; -import { View } from "tamagui"; -import QRCode from "qrcode"; import { Countdown } from "components"; -import { str2ab } from "quietjs-bundle"; import { QUIET_PROFILE } from "components/player/av-sync"; +import QRCode from "qrcode"; +import { str2ab } from "quietjs-bundle"; +import { useEffect, useRef } from "react"; +import { View } from "tamagui"; // screen that displays timestamp as a QR code and encodes timestamp in audio // so we can measure sync between them diff --git a/js/app/src/screens/download.tsx b/js/app/src/screens/download.tsx index 7f64df208..7bd2a5d12 100644 --- a/js/app/src/screens/download.tsx +++ b/js/app/src/screens/download.tsx @@ -1,4 +1,4 @@ -import { H4 as TamaguiH4, Paragraph, View, Anchor } from "tamagui"; +import { Anchor, Paragraph, H4 as TamaguiH4, View } from "tamagui"; import GetApps from "../../components/get-apps"; const H4 = (props: any) => ; diff --git a/js/app/src/screens/embed.tsx b/js/app/src/screens/embed.tsx index b3d27c4cb..69d7281cb 100644 --- a/js/app/src/screens/embed.tsx +++ b/js/app/src/screens/embed.tsx @@ -1,7 +1,7 @@ +import { Player } from "components"; import { PlayerProps } from "components/player/props"; import { isWeb } from "tamagui"; import { queryToProps } from "./util"; -import { Player } from "components"; export default function EmbedScreen({ route }) { const { user, protocol, url } = route.params; diff --git a/js/app/src/screens/home.tsx b/js/app/src/screens/home.tsx index 9c9ba9096..193a4b6b6 100644 --- a/js/app/src/screens/home.tsx +++ b/js/app/src/screens/home.tsx @@ -1,14 +1,14 @@ +import { AlertCircle } from "@tamagui/lucide-icons"; import { UseMediaState } from "@tamagui/web"; import AQLink from "components/aqlink"; +import Container from "components/container"; import ErrorBox from "components/error/error"; -import Loading from "components/loading/loading"; import StreamCardHorizontal, { StreamCardSize } from "components/home/cards"; -import Container from "components/container"; import LiveDot from "components/home/live-dot"; +import Loading from "components/loading/loading"; import Title from "components/title"; import { pollSegments, - Repo, selectRecentSegments, } from "features/streamplace/streamplaceSlice"; import useAvatars from "hooks/useAvatars"; @@ -16,18 +16,17 @@ import useStreamplaceNode from "hooks/useStreamplaceNode"; import { useEffect, useState } from "react"; import { RefreshControl } from "react-native"; import { useAppDispatch, useAppSelector } from "store/hooks"; +import { PlaceStreamLivestream } from "streamplace"; import { + H3, + Image, + Paragraph, ScrollView, ScrollViewProps, + Text, useMedia, View, - Image, - Paragraph, - H3, - Text, } from "tamagui"; -import { LivestreamRecord, PlaceStreamLivestream } from "streamplace"; -import { AlertCircle, AlertTriangle } from "@tamagui/lucide-icons"; // as we're not using a specific grid library these are necessary // to constrain the cards diff --git a/js/app/src/screens/live-dashboard.tsx b/js/app/src/screens/live-dashboard.tsx index 02191014f..9d6a424bb 100644 --- a/js/app/src/screens/live-dashboard.tsx +++ b/js/app/src/screens/live-dashboard.tsx @@ -1,23 +1,22 @@ +import { Camera, FerrisWheel, X } from "@tamagui/lucide-icons"; +import { Redirect } from "components/aqlink"; import CreateLivestream from "components/create-livestream"; -import { Button, isWeb, View } from "tamagui"; -import { Player } from "components/player/player"; +import UpdateLivestream from "components/edit-livestream"; +import StreamKeyScreen from "components/live-dashboard/stream-key"; +import Waiting from "components/live-dashboard/waiting"; import Loading from "components/loading/loading"; +import { Player } from "components/player/player"; +import ButtonSelector from "components/ui/button-selector"; +import { VideoElementProvider } from "contexts/VideoElementContext"; import { selectIsReady, selectUserProfile, } from "features/bluesky/blueskySlice"; -import { useAppSelector } from "store/hooks"; -import { Redirect } from "components/aqlink"; -import React, { useCallback, useState } from "react"; -import { useLiveUser } from "hooks/useLiveUser"; -import StreamKeyScreen from "components/live-dashboard/stream-key"; -import { VideoElementProvider } from "contexts/VideoElementContext"; -import { Camera, FerrisWheel, X } from "@tamagui/lucide-icons"; -import { H6, Text } from "tamagui"; -import Waiting from "components/live-dashboard/waiting"; import { selectTelemetry } from "features/streamplace/streamplaceSlice"; -import UpdateLivestream from "components/edit-livestream"; -import ButtonSelector from "components/ui/button-selector"; +import { useLiveUser } from "hooks/useLiveUser"; +import React, { useCallback, useState } from "react"; +import { useAppSelector } from "store/hooks"; +import { Button, H6, isWeb, Text, View } from "tamagui"; enum StreamSource { Start, diff --git a/js/app/src/screens/stream.tsx b/js/app/src/screens/stream.tsx index 880ef1bf5..629e29d48 100644 --- a/js/app/src/screens/stream.tsx +++ b/js/app/src/screens/stream.tsx @@ -1,8 +1,8 @@ +import Livestream from "components/livestream/livestream"; import { PlayerProps } from "components/player/props"; +import { FullscreenProvider } from "contexts/FullscreenContext"; import { isWeb } from "tamagui"; import { queryToProps } from "./util"; -import Livestream from "components/livestream/livestream"; -import { FullscreenProvider } from "contexts/FullscreenContext"; export default function StreamScreen({ route }) { const { user, protocol, url } = route.params; diff --git a/js/app/storage/storage.native.tsx b/js/app/storage/storage.native.tsx index bd955ace5..1ac35236b 100644 --- a/js/app/storage/storage.native.tsx +++ b/js/app/storage/storage.native.tsx @@ -1,6 +1,6 @@ import Storage from "expo-sqlite/kv-store"; -import { AQStorage } from "./storage.shared"; import { Lock } from "./lock"; +import { AQStorage } from "./storage.shared"; // Needed because concurrent calls seem to return with a locked database const lock = new Lock(); diff --git a/js/app/store/listener.ts b/js/app/store/listener.ts index 27ae9aa2f..ee7843ad9 100644 --- a/js/app/store/listener.ts +++ b/js/app/store/listener.ts @@ -1,7 +1,7 @@ import { createListenerMiddleware, isAnyOf } from "@reduxjs/toolkit"; import { SIDEBAR_STORAGE_KEY, sidebarSlice } from "features/base/sidebarSlice"; -import { RootState } from "./store"; import storage from "storage"; +import { RootState } from "./store"; export const listenerMiddleware = createListenerMiddleware(); diff --git a/js/app/store/store.tsx b/js/app/store/store.tsx index a4b89e5fd..08d7dc6df 100644 --- a/js/app/store/store.tsx +++ b/js/app/store/store.tsx @@ -1,12 +1,12 @@ import type { Action, ThunkAction } from "@reduxjs/toolkit"; import { combineSlices, configureStore } from "@reduxjs/toolkit"; import { setupListeners } from "@reduxjs/toolkit/query"; -import { streamplaceSlice } from "features/streamplace/streamplaceSlice"; import { baseSlice } from "features/base/baseSlice"; +import { sidebarSlice } from "features/base/sidebarSlice"; import { blueskySlice } from "features/bluesky/blueskySlice"; import { platformSlice } from "features/platform/platformSlice"; import { playerSlice } from "features/player/playerSlice"; -import { sidebarSlice } from "features/base/sidebarSlice"; +import { streamplaceSlice } from "features/streamplace/streamplaceSlice"; import { listenerMiddleware } from "./listener"; diff --git a/js/app/tamagui.config.ts b/js/app/tamagui.config.ts index 628b95f14..942422b20 100644 --- a/js/app/tamagui.config.ts +++ b/js/app/tamagui.config.ts @@ -1,5 +1,5 @@ import { config as configBase } from "@tamagui/config/v3"; -import { createTamagui, createFont } from "tamagui"; +import { createFont, createTamagui } from "tamagui"; const sizes = { "1": 11, diff --git a/js/app/utils/videoCapture.ts b/js/app/utils/videoCapture.ts index 12f733a60..11d0ce0c5 100644 --- a/js/app/utils/videoCapture.ts +++ b/js/app/utils/videoCapture.ts @@ -1,8 +1,8 @@ /** * Utility functions for capturing video frames */ -import { isWeb } from "tamagui"; import React from "react"; +import { isWeb } from "tamagui"; /** * Captures a frame from a video ref or element and returns it as a compressed JPEG blob diff --git a/js/desktop/src/env.ts b/js/desktop/src/env.ts index 6cdc333e4..f5dbb8a5b 100644 --- a/js/desktop/src/env.ts +++ b/js/desktop/src/env.ts @@ -27,4 +27,4 @@ export default function getEnv() { declare const MAIN_WINDOW_WEBPACK_ENTRY: string; declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string; -export { MAIN_WINDOW_WEBPACK_ENTRY, MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY }; +export { MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY, MAIN_WINDOW_WEBPACK_ENTRY }; diff --git a/js/desktop/src/index.ts b/js/desktop/src/index.ts index 1b70e50d3..f401b8f54 100644 --- a/js/desktop/src/index.ts +++ b/js/desktop/src/index.ts @@ -1,13 +1,12 @@ import { app, dialog, ipcMain } from "electron"; import { parseArgs } from "node:util"; import "source-map-support/register"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; import getEnv from "./env"; import makeNode from "./node"; +import runTests, { allTestNames } from "./tests/test-runner"; import initUpdater from "./updater"; -import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; import { makeWindow } from "./window"; -import runTests from "./tests/test-runner"; -import { allTestNames } from "./tests/test-runner"; // Handle creating/removing shortcuts on Windows when installing/uninstalling. if (require("electron-squirrel-startup")) { diff --git a/js/desktop/src/node.ts b/js/desktop/src/node.ts index 8884561da..090f285d2 100644 --- a/js/desktop/src/node.ts +++ b/js/desktop/src/node.ts @@ -1,9 +1,9 @@ +import { spawn } from "child_process"; +import { app } from "electron"; +import { access, constants } from "fs/promises"; import os from "os"; import { resolve } from "path"; -import { access, constants } from "fs/promises"; -import { spawn } from "child_process"; import getEnv from "./env"; -import { app } from "electron"; const findExe = async (): Promise => { const { isDev } = getEnv(); diff --git a/js/desktop/src/tests/playback-test.ts b/js/desktop/src/tests/playback-test.ts index 8e32f30ef..0e5ae3c75 100644 --- a/js/desktop/src/tests/playback-test.ts +++ b/js/desktop/src/tests/playback-test.ts @@ -1,7 +1,7 @@ -import { delay, PlayerReport } from "./util"; import { v7 as uuidv7 } from "uuid"; import { makeWindow } from "../window"; import { E2ETest, TestEnv } from "./test-env"; +import { delay, PlayerReport } from "./util"; const PLAYING_SUCCESS = 0.5; diff --git a/js/desktop/src/tests/sync-test.ts b/js/desktop/src/tests/sync-test.ts index ca15c0b8b..67dc14e33 100644 --- a/js/desktop/src/tests/sync-test.ts +++ b/js/desktop/src/tests/sync-test.ts @@ -1,8 +1,8 @@ -import { BrowserWindow, WebFrameMain, webFrameMain, session } from "electron"; +import { BrowserWindow, session, WebFrameMain, webFrameMain } from "electron"; +import { v7 as uuidv7 } from "uuid"; import { MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY } from "../env"; -import { delay, PlayerReport } from "./util"; import { E2ETest, TestEnv } from "./test-env"; -import { v7 as uuidv7 } from "uuid"; +import { delay, PlayerReport } from "./util"; const SYNC_TOO_FAR = 20000; diff --git a/js/desktop/src/tests/test-runner.ts b/js/desktop/src/tests/test-runner.ts index 1b0c31060..ac55f4982 100644 --- a/js/desktop/src/tests/test-runner.ts +++ b/js/desktop/src/tests/test-runner.ts @@ -1,14 +1,14 @@ import { bytesToMultibase } from "@atproto/crypto"; +import { ChildProcess } from "child_process"; +import fs from "fs/promises"; +import os from "os"; +import path from "path"; +import { privateKeyToAccount } from "viem/accounts"; import getEnv from "../env"; import makeNode from "../node"; import { playbackTest } from "./playback-test"; import { syncTest } from "./sync-test"; import { E2ETest, TestEnv } from "./test-env"; -import { ChildProcess } from "child_process"; -import { privateKeyToAccount } from "viem/accounts"; -import fs from "fs/promises"; -import path from "path"; -import os from "os"; const allTests: Record = { playback: playbackTest, diff --git a/js/desktop/src/updater.ts b/js/desktop/src/updater.ts index 072678af5..3f0ccb542 100644 --- a/js/desktop/src/updater.ts +++ b/js/desktop/src/updater.ts @@ -1,11 +1,11 @@ +import electron from "electron"; +import ms from "ms"; import { IUpdateElectronAppOptions, UpdateSourceType, } from "update-electron-app"; -import electron from "electron"; -import ms from "ms"; -import * as build from "./version"; import env from "./env"; +import * as build from "./version"; const supportedPlatforms = ["darwin", "win32"]; diff --git a/js/desktop/src/window.ts b/js/desktop/src/window.ts index 6fd0f8d02..601dfba57 100644 --- a/js/desktop/src/window.ts +++ b/js/desktop/src/window.ts @@ -1,6 +1,6 @@ import { BrowserWindow, globalShortcut } from "electron"; -import getEnv, { MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY } from "./env"; import { resolve } from "path"; +import getEnv, { MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY } from "./env"; export const makeWindow = async (): Promise => { const { isDev } = getEnv(); diff --git a/js/desktop/webpack.main.config.ts b/js/desktop/webpack.main.config.ts index eeac9eb59..0d3702c7c 100644 --- a/js/desktop/webpack.main.config.ts +++ b/js/desktop/webpack.main.config.ts @@ -1,7 +1,7 @@ import type { Configuration } from "webpack"; -import { rules } from "./webpack.rules"; import { plugins } from "./webpack.plugins"; +import { rules } from "./webpack.rules"; export const mainConfig: Configuration = { /** diff --git a/js/desktop/webpack.renderer.config.ts b/js/desktop/webpack.renderer.config.ts index c833d4523..e52df2189 100644 --- a/js/desktop/webpack.renderer.config.ts +++ b/js/desktop/webpack.renderer.config.ts @@ -1,7 +1,7 @@ import type { Configuration } from "webpack"; -import { rules } from "./webpack.rules"; import { plugins } from "./webpack.plugins"; +import { rules } from "./webpack.rules"; rules.push({ test: /\.css$/, diff --git a/js/docs/astro.config.mjs b/js/docs/astro.config.mjs index 4a0a4e778..ac8440ccd 100644 --- a/js/docs/astro.config.mjs +++ b/js/docs/astro.config.mjs @@ -1,6 +1,6 @@ // @ts-check -import { defineConfig } from "astro/config"; import starlight from "@astrojs/starlight"; +import { defineConfig } from "astro/config"; import starlightOpenAPI, { openAPISidebarGroups } from "starlight-openapi"; // https://astro.build/config diff --git a/js/docs/src/content.config.ts b/js/docs/src/content.config.ts index 7fbcf2c33..0bead4244 100644 --- a/js/docs/src/content.config.ts +++ b/js/docs/src/content.config.ts @@ -1,6 +1,6 @@ -import { defineCollection } from "astro:content"; import { docsLoader } from "@astrojs/starlight/loaders"; import { docsSchema } from "@astrojs/starlight/schema"; +import { defineCollection } from "astro:content"; export const collections = { docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), diff --git a/package.json b/package.json index a67db5289..3b2f5d75e 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ ], "dependencies": { "firebase-admin": "^12.7.0", - "lex-md": "^0.1.0" + "lex-md": "^0.1.0", + "prettier-plugin-organize-imports": "^4.1.0" }, "packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9fda25e92..864918a3e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: lex-md: specifier: ^0.1.0 version: 0.1.0 + prettier-plugin-organize-imports: + specifier: ^4.1.0 + version: 4.1.0(prettier@3.4.2)(typescript@5.6.3) devDependencies: '@atproto/lex-cli': specifier: ^0.5.6 @@ -10547,6 +10550,16 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-plugin-organize-imports@4.1.0: + resolution: {integrity: sha512-5aWRdCgv645xaa58X8lOxzZoiHAldAPChljr/MT0crXVOWTZ+Svl4hIWlz+niYSlO6ikE5UXkN1JrRvIP2ut0A==} + peerDependencies: + prettier: '>=2.0' + typescript: '>=2.9' + vue-tsc: ^2.1.0 + peerDependenciesMeta: + vue-tsc: + optional: true + prettier@3.4.2: resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} engines: {node: '>=14'} @@ -27448,6 +27461,11 @@ snapshots: prelude-ls@1.2.1: {} + prettier-plugin-organize-imports@4.1.0(prettier@3.4.2)(typescript@5.6.3): + dependencies: + prettier: 3.4.2 + typescript: 5.6.3 + prettier@3.4.2: {} pretty-bytes@5.6.0: {} -- 2.51.2