@adminide-stack/yantra-mobile 12.0.171 → 12.0.172-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/GatewayConnector/GatewayConnector.js +10 -4
- package/lib/components/GatewayConnector/GatewayConnector.js.map +1 -1
- package/lib/components/GatewayConnector/GatewayStatusSheet.js +174 -0
- package/lib/components/GatewayConnector/GatewayStatusSheet.js.map +1 -0
- package/lib/components/GatewayToolbarButtonMobile.js +6 -2
- package/lib/components/GatewayToolbarButtonMobile.js.map +1 -1
- package/lib/compute.js +51 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +12 -3
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/apps/AppsCatalog.js +10 -0
- package/lib/features/apps/AppsCatalog.js.map +1 -1
- package/lib/features/apps/mobileAppCatalog.js +9 -0
- package/lib/features/apps/mobileAppCatalog.js.map +1 -1
- package/lib/features/apps/nativeAppHandoff.js +31 -13
- package/lib/features/apps/nativeAppHandoff.js.map +1 -1
- package/lib/features/apps/nativeSurfaceTwin.js +2 -1
- package/lib/features/apps/nativeSurfaceTwin.js.map +1 -1
- package/lib/features/canvas/set/agent/prompt.js +4 -5
- package/lib/features/canvas/set/agent/prompt.js.map +1 -1
- package/lib/features/canvas/set/supplyLibrary.js +1294 -2
- package/lib/features/canvas/set/supplyLibrary.js.map +1 -1
- package/lib/features/chat/PromptFillBar.js +153 -0
- package/lib/features/chat/PromptFillBar.js.map +1 -0
- package/lib/features/chat/promptBlanks.js +120 -0
- package/lib/features/chat/promptBlanks.js.map +1 -0
- package/lib/features/chat/savedReply.js +11 -0
- package/lib/features/chat/savedReply.js.map +1 -0
- package/lib/features/games/GameInviteCard.js +93 -0
- package/lib/features/games/GameInviteCard.js.map +1 -0
- package/lib/features/games/cubeforge3D.js +97 -0
- package/lib/features/games/cubeforge3D.js.map +1 -0
- package/lib/features/games/cubeforgeFriends.js +112 -0
- package/lib/features/games/cubeforgeFriends.js.map +1 -0
- package/lib/features/games/gameInvite.js +13 -0
- package/lib/features/games/gameInvite.js.map +1 -0
- package/lib/features/games/useCubeforgeFriends.js +63 -0
- package/lib/features/games/useCubeforgeFriends.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/permissions.js +76 -0
- package/lib/features/games/vendored/core/classroom/permissions.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/resourceLink.js +101 -0
- package/lib/features/games/vendored/core/classroom/resourceLink.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/rules.js +83 -0
- package/lib/features/games/vendored/core/classroom/rules.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/worldSettings.js +49 -0
- package/lib/features/games/vendored/core/classroom/worldSettings.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/cycle.js +15 -0
- package/lib/features/games/vendored/core/cubeforge/cycle.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/inventory.js +75 -0
- package/lib/features/games/vendored/core/cubeforge/inventory.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/items.js +62 -0
- package/lib/features/games/vendored/core/cubeforge/items.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorld.js +4 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorld.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorlds.js +68 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorlds.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/recipes.js +52 -0
- package/lib/features/games/vendored/core/cubeforge/recipes.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/save.js +92 -0
- package/lib/features/games/vendored/core/cubeforge/save.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/session.js +154 -0
- package/lib/features/games/vendored/core/cubeforge/session.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/sharedWorlds.js +10 -0
- package/lib/features/games/vendored/core/cubeforge/sharedWorlds.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/worldgen.js +44 -0
- package/lib/features/games/vendored/core/cubeforge/worldgen.js.map +1 -0
- package/lib/features/games/vendored/core/engine/iso.js +41 -0
- package/lib/features/games/vendored/core/engine/iso.js.map +1 -0
- package/lib/features/games/vendored/core/engine/palette.js +53 -0
- package/lib/features/games/vendored/core/engine/palette.js.map +1 -0
- package/lib/features/games/vendored/core/engine/world.js +148 -0
- package/lib/features/games/vendored/core/engine/world.js.map +1 -0
- package/lib/features/games/vendored/core/games/catalog.js +34 -0
- package/lib/features/games/vendored/core/games/catalog.js.map +1 -0
- package/lib/features/games/vendored/core/lessons/lessons.js +97 -0
- package/lib/features/games/vendored/core/lessons/lessons.js.map +1 -0
- package/lib/features/games/vendored/core/logging/events.js +24 -0
- package/lib/features/games/vendored/core/logging/events.js.map +1 -0
- package/lib/features/games/vendored/core/logging/logger.js +54 -0
- package/lib/features/games/vendored/core/logging/logger.js.map +1 -0
- package/lib/features/games/vendored/core/session/gameSession.js +317 -0
- package/lib/features/games/vendored/core/session/gameSession.js.map +1 -0
- package/lib/features/games/vendored/core/storage/worldRepository.js +192 -0
- package/lib/features/games/vendored/core/storage/worldRepository.js.map +1 -0
- package/lib/features/games/vendored/core/store/reactive.js +78 -0
- package/lib/features/games/vendored/core/store/reactive.js.map +1 -0
- package/lib/features/games/vendored/ui/GamesRoot.js +223 -0
- package/lib/features/games/vendored/ui/GamesRoot.js.map +1 -0
- package/lib/features/games/vendored/ui/components/BlockPalette.js +64 -0
- package/lib/features/games/vendored/ui/components/BlockPalette.js.map +1 -0
- package/lib/features/games/vendored/ui/components/IsoCanvas.js +124 -0
- package/lib/features/games/vendored/ui/components/IsoCanvas.js.map +1 -0
- package/lib/features/games/vendored/ui/components/primitives.js +257 -0
- package/lib/features/games/vendored/ui/components/primitives.js.map +1 -0
- package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js +3 -0
- package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/ActivityScreen.js +68 -0
- package/lib/features/games/vendored/ui/screens/ActivityScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/BuilderScreen.js +227 -0
- package/lib/features/games/vendored/ui/screens/BuilderScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/ClassroomScreen.js +95 -0
- package/lib/features/games/vendored/ui/screens/ClassroomScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js +296 -0
- package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js +342 -0
- package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/HubScreen.js +131 -0
- package/lib/features/games/vendored/ui/screens/HubScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/ScreenHeader.js +51 -0
- package/lib/features/games/vendored/ui/screens/ScreenHeader.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/WorldListScreen.js +134 -0
- package/lib/features/games/vendored/ui/screens/WorldListScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/storage/asyncStorageAdapter.js +23 -0
- package/lib/features/games/vendored/ui/storage/asyncStorageAdapter.js.map +1 -0
- package/lib/features/games/vendored/ui/theme.js +53 -0
- package/lib/features/games/vendored/ui/theme.js.map +1 -0
- package/lib/features/messaging/ChatComponents.js +12 -4
- package/lib/features/messaging/ChatComponents.js.map +1 -1
- package/lib/features/messaging/messageCards.js +22 -0
- package/lib/features/messaging/messageCards.js.map +1 -0
- package/lib/features/travel/TravelAgentChatPane.js +9 -1
- package/lib/features/travel/TravelAgentChatPane.js.map +1 -1
- package/lib/hooks/useCdecliAutoConnect.js +8 -1
- package/lib/hooks/useCdecliAutoConnect.js.map +1 -1
- package/lib/hooks/useCdecliChannel.js +142 -49
- package/lib/hooks/useCdecliChannel.js.map +1 -1
- package/lib/hooks/useChatApi.js +21 -10
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/useChatStream.js +18 -5
- package/lib/hooks/useChatStream.js.map +1 -1
- package/lib/module.js +2 -1
- package/lib/module.js.map +1 -1
- package/lib/routes.json +50 -0
- package/lib/screens/Chat/index.js +23 -15
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/GamesNative/index.js +75 -0
- package/lib/screens/GamesNative/index.js.map +1 -0
- package/lib/screens/Home/HomeScreen.js +147 -33
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeSuggestions.js +1 -1
- package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
- package/lib/screens/Home/components/homeCatalog.js +68 -16
- package/lib/screens/Home/components/homeCatalog.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {useLayoutEffect,useCallback,useEffect}from'react';import {SafeAreaView}from'react-native-safe-area-context';import {Alert,StyleSheet}from'react-native';import {useNavigation,useRoute}from'@react-navigation/native';import'../../features/games/vendored/core/engine/palette.js';import'../../features/games/vendored/core/lessons/lessons.js';import'../../features/games/vendored/core/cubeforge/items.js';import'../../features/games/vendored/core/cubeforge/recipes.js';import {YantraGames}from'../../features/games/vendored/ui/GamesRoot.js';import'@react-native-async-storage/async-storage';import {cubeforgeFriendsSupported,cubeforge3DComponent,deleteCubeforgeSave}from'../../features/games/cubeforge3D.js';import {useCubeforgeFriends}from'../../features/games/useCubeforgeFriends.js';import {config}from'../../config/env-config.js';import {usePrerequisiteIds}from'../../hooks/usePrerequisiteIds.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
function GamesWithFriends(props) {
|
|
21
|
+
const friends = useCubeforgeFriends();
|
|
22
|
+
return /* @__PURE__ */ jsx(YantraGames, __spreadProps(__spreadValues({}, props), { cubeforgeFriends: friends }));
|
|
23
|
+
}
|
|
24
|
+
function GamesNativeScreen() {
|
|
25
|
+
var _a, _b, _c, _d;
|
|
26
|
+
const {
|
|
27
|
+
isDark
|
|
28
|
+
} = useAppTheme();
|
|
29
|
+
const navigation = useNavigation();
|
|
30
|
+
const route = useRoute();
|
|
31
|
+
const {
|
|
32
|
+
orgName: currentOrg
|
|
33
|
+
} = usePrerequisiteIds();
|
|
34
|
+
const orgName = ((_a = route.params) == null ? void 0 : _a.orgName) || currentOrg || "";
|
|
35
|
+
const invite = (_b = route.params) == null ? void 0 : _b.cubeforgeInvite;
|
|
36
|
+
const friendsReady = cubeforgeFriendsSupported() && Boolean(config.GAMES_SUBGRAPH_URL);
|
|
37
|
+
useLayoutEffect(() => {
|
|
38
|
+
var _a2;
|
|
39
|
+
if (!((_a2 = route.params) == null ? void 0 : _a2.hideNavigationHeader)) navigation.setParams({
|
|
40
|
+
hideNavigationHeader: true
|
|
41
|
+
});
|
|
42
|
+
}, [navigation, (_c = route.params) == null ? void 0 : _c.hideNavigationHeader]);
|
|
43
|
+
const onExit = useCallback(() => {
|
|
44
|
+
var _a2;
|
|
45
|
+
if ((_a2 = navigation.canGoBack) == null ? void 0 : _a2.call(navigation)) navigation.goBack();
|
|
46
|
+
else navigation.navigate("MainStack.Layout.Home");
|
|
47
|
+
}, [navigation]);
|
|
48
|
+
const onInviteHandled = useCallback((error) => {
|
|
49
|
+
navigation.setParams({
|
|
50
|
+
cubeforgeInvite: void 0,
|
|
51
|
+
inviteAt: void 0
|
|
52
|
+
});
|
|
53
|
+
if (error) Alert.alert("Could not join", error);
|
|
54
|
+
}, [navigation]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (invite && !friendsReady) onInviteHandled("Playing with friends needs the latest Yantra on iPhone.");
|
|
57
|
+
}, [invite, friendsReady, onInviteHandled]);
|
|
58
|
+
const shared = {
|
|
59
|
+
orgName,
|
|
60
|
+
theme: isDark ? "dark" : "light",
|
|
61
|
+
onExit,
|
|
62
|
+
cubeforge3D: (_d = cubeforge3DComponent()) != null ? _d : void 0,
|
|
63
|
+
deleteCubeforge3DSave: deleteCubeforgeSave
|
|
64
|
+
};
|
|
65
|
+
return /* @__PURE__ */ jsx(SafeAreaView, { style: [styles.fill, isDark && styles.fillDark], edges: ["top", "left", "right"], children: friendsReady ? /* @__PURE__ */ jsx(GamesWithFriends, __spreadProps(__spreadValues({}, shared), { cubeforgeInvite: invite, onCubeforgeInviteHandled: onInviteHandled })) : /* @__PURE__ */ jsx(YantraGames, __spreadValues({}, shared)) });
|
|
66
|
+
}
|
|
67
|
+
const styles = StyleSheet.create({
|
|
68
|
+
fill: {
|
|
69
|
+
flex: 1,
|
|
70
|
+
backgroundColor: "#f4f6f8"
|
|
71
|
+
},
|
|
72
|
+
fillDark: {
|
|
73
|
+
backgroundColor: "#12161b"
|
|
74
|
+
}
|
|
75
|
+
});export{GamesNativeScreen as default};//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/screens/GamesNative/index.tsx"],"sourcesContent":["/**\n * Native Games screen - host route for the Yantra Games experience.\n *\n * Yantra Games runs in the binary (local-first: AsyncStorage worlds, no backend\n * and no federated remote), so this screen is a thin host: it passes the org and\n * the theme and lets the experience own the rest. Yantra Games draws its own\n * per-screen headers, so the stack header stays hidden.\n */\nimport React, { useCallback, useEffect, useLayoutEffect } from 'react';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { Alert, StyleSheet } from 'react-native';\nimport {\n useNavigation,\n useRoute,\n type NavigationProp,\n type ParamListBase,\n type RouteProp,\n} from '@react-navigation/native';\nimport { YantraGames, type YantraGamesProps } from '../../features/games/vendored';\nimport { cubeforge3DComponent, cubeforgeFriendsSupported, deleteCubeforgeSave } from '../../features/games/cubeforge3D';\nimport { useCubeforgeFriends } from '../../features/games/useCubeforgeFriends';\nimport { config } from '../../config/env-config';\nimport { usePrerequisiteIds } from '../../hooks/usePrerequisiteIds';\nimport { useAppTheme } from '../../theme/AppThemeProvider';\n\ntype GamesRouteParams = {\n orgName?: string | null;\n hideNavigationHeader?: boolean;\n /** An invite to accept, from a tapped chat card. */\n cubeforgeInvite?: string;\n /** When the card was tapped; a new value retries the same invite. */\n inviteAt?: number;\n};\n\nfunction GamesWithFriends(props: YantraGamesProps) {\n const friends = useCubeforgeFriends();\n return <YantraGames {...props} cubeforgeFriends={friends} />;\n}\n\nexport default function GamesNativeScreen() {\n const { isDark } = useAppTheme();\n const navigation = useNavigation<NavigationProp<ParamListBase>>();\n const route = useRoute<RouteProp<Record<string, GamesRouteParams | undefined>, string>>();\n const { orgName: currentOrg } = usePrerequisiteIds();\n const orgName = route.params?.orgName || currentOrg || '';\n const invite = route.params?.cubeforgeInvite;\n const friendsReady = cubeforgeFriendsSupported() && Boolean(config.GAMES_SUBGRAPH_URL);\n\n useLayoutEffect(() => {\n if (!route.params?.hideNavigationHeader) navigation.setParams({ hideNavigationHeader: true });\n }, [navigation, route.params?.hideNavigationHeader]);\n\n const onExit = useCallback(() => {\n if (navigation.canGoBack?.()) navigation.goBack();\n else navigation.navigate('MainStack.Layout.Home');\n }, [navigation]);\n\n const onInviteHandled = useCallback(\n (error: string | null) => {\n navigation.setParams({ cubeforgeInvite: undefined, inviteAt: undefined });\n if (error) Alert.alert('Could not join', error);\n },\n [navigation],\n );\n\n // Older binaries and Android have no shared worlds to open.\n useEffect(() => {\n if (invite && !friendsReady) onInviteHandled('Playing with friends needs the latest Yantra on iPhone.');\n }, [invite, friendsReady, onInviteHandled]);\n\n const shared: YantraGamesProps = {\n orgName,\n theme: isDark ? 'dark' : 'light',\n onExit,\n cubeforge3D: cubeforge3DComponent() ?? undefined,\n deleteCubeforge3DSave: deleteCubeforgeSave,\n };\n\n return (\n <SafeAreaView style={[styles.fill, isDark && styles.fillDark]} edges={['top', 'left', 'right']}>\n {friendsReady ? (\n <GamesWithFriends {...shared} cubeforgeInvite={invite} onCubeforgeInviteHandled={onInviteHandled} />\n ) : (\n <YantraGames {...shared} />\n )}\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n fill: { flex: 1, backgroundColor: '#f4f6f8' },\n fillDark: { backgroundColor: '#12161b' },\n});\n"],"names":["_a"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React__default,{useRef,useState,useCallback,useMemo,useEffect}from'react';import {View,StyleSheet,useWindowDimensions,InteractionManager,Animated,Keyboard,Pressable,Platform}from'react-native';import {Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,useFocusEffect,CommonActions,useIsFocused}from'@react-navigation/native';import {useDispatch,useSelector}from'react-redux';import {userSelector}from'@adminide-stack/user-auth0-client';import {v4}from'uuid';import {pickGivenName}from'../../utils/authUserDisplay.js';import {KeyboardAwareScreen,KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {useKeyboardBottomOffset}from'../../hooks/useKeyboardBottomOffset.js';import {dismissKeyboard}from'../../utils/keyboardController.js';import {usePrerequisiteIds}from'../../hooks/usePrerequisiteIds.js';import {syncMobileOrgRouteContext}from'../../utils/syncMobileOrgRouteContext.js';import {useChatMutations,usePrefetchChatHistory}from'../../hooks/useChatApi.js';import {hydrateChatHistorySnapshot,persistChatHistorySnapshot}from'../../features/chat/chatHistorySnapshot.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';import {mobileTokens}from'../../theme/mobileTokens.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {groupByKind,BUILD_KINDS,kindForGroup,buildKind,CODE_ASSISTANT_GROUP}from'../../features/templates/buildKinds.js';import {ComposerModeSwitch,composerMode}from'../../features/chat/ComposerModeSwitch.js';import {useMarketplaceTemplateGroups}from'../../hooks/useMarketplaceTemplateGroups.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {ComposerAttachmentBar}from'../../features/attachments/ComposerAttachmentBar.js';import {useComposerAttachMenu}from'../../features/attachments/ComposerAttachMenu.js';import {stashComposerAttachments}from'../../features/attachments/composerAttachmentHandoff.js';import {nativeHandoffParams}from'../../features/apps/nativeAppNavigation.js';import {ConnectAppsSheet}from'../../features/channels/ConnectAppsSheet.js';import {HomeImessage}from'../../features/channels/HomeImessage.js';import {IMESSAGE_CHANNEL}from'../../features/channels/channelLinks.js';import {useChannelBindings}from'../../features/channels/useChannelsApi.js';import {ChatModelSheet}from'../../features/chat/ChatModelSheet.js';import {HomeSky}from'../../features/home/sky/HomeSky.js';import {setHomeSkyBar}from'../../features/home/sky/homeSkyBar.js';import {useSkyScene}from'../../features/home/sky/useSkyScene.js';import {useHomeWeather}from'../../features/home/useHomeWeather.js';import {BuildKindPicker,BuildGroupTabs}from'./components/BuildKindPicker.js';import {buildPalette}from'./components/buildTheme.js';import {BuildTemplatesSection}from'./components/BuildTemplatesSection.js';import {ChooseTemplateModal}from'./components/ChooseTemplateModal.js';import {TemplateSuggestionBanner}from'./components/TemplateSuggestionBanner.js';import {SUGGEST_MIN_QUERY,suggestTemplateGroup,SUGGEST_DEBOUNCE_MS}from'../../features/templates/templateSuggestion.js';import {HomeHero}from'./components/HomeHero.js';import {FreeCreditsCard}from'../../features/credits/FreeCreditsCard.js';import {shouldOfferFreeCredits}from'../../features/credits/freeCredits.js';import {useFreeCredits}from'../../features/credits/useFreeCredits.js';import {HomeSuggestions}from'./components/HomeSuggestions.js';import {HomeWash}from'./components/HomeWash.js';import {WebBuilderPrewarm}from'./components/WebBuilderPrewarm.js';import {CanvasPrewarm}from'./components/CanvasPrewarm.js';import {WebBuilderCodePrewarm}from'./components/WebBuilderCodePrewarm.js';import {resetDrawerClosed,dispatchDrawerAction,afterNativeModalClose}from'../../utils/drawerNavigation.js';var __defProp = Object.defineProperty;
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React__default,{useRef,useState,useCallback,useMemo,useEffect}from'react';import {View,StyleSheet,useWindowDimensions,InteractionManager,Animated,Keyboard,Pressable,Platform}from'react-native';import {Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,useFocusEffect,CommonActions,useIsFocused}from'@react-navigation/native';import {useDispatch,useSelector}from'react-redux';import {userSelector}from'@adminide-stack/user-auth0-client';import {v4}from'uuid';import {pickGivenName}from'../../utils/authUserDisplay.js';import {KeyboardAwareScreen,KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {useKeyboardBottomOffset}from'../../hooks/useKeyboardBottomOffset.js';import {dismissKeyboard}from'../../utils/keyboardController.js';import {usePrerequisiteIds}from'../../hooks/usePrerequisiteIds.js';import {syncMobileOrgRouteContext}from'../../utils/syncMobileOrgRouteContext.js';import {useChatMutations,usePrefetchChatHistory}from'../../hooks/useChatApi.js';import {hydrateChatHistorySnapshot,persistChatHistorySnapshot}from'../../features/chat/chatHistorySnapshot.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';import {mobileTokens}from'../../theme/mobileTokens.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {groupByKind,BUILD_KINDS,kindForGroup,buildKind,CODE_ASSISTANT_GROUP}from'../../features/templates/buildKinds.js';import {ComposerModeSwitch,composerMode}from'../../features/chat/ComposerModeSwitch.js';import {useMarketplaceTemplateGroups}from'../../hooks/useMarketplaceTemplateGroups.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {ComposerAttachmentBar}from'../../features/attachments/ComposerAttachmentBar.js';import {useComposerAttachMenu}from'../../features/attachments/ComposerAttachMenu.js';import {stashComposerAttachments}from'../../features/attachments/composerAttachmentHandoff.js';import {nativeHandoffParams}from'../../features/apps/nativeAppNavigation.js';import {ConnectAppsSheet}from'../../features/channels/ConnectAppsSheet.js';import {HomeImessage}from'../../features/channels/HomeImessage.js';import {IMESSAGE_CHANNEL}from'../../features/channels/channelLinks.js';import {useChannelBindings}from'../../features/channels/useChannelsApi.js';import {ChatModelSheet}from'../../features/chat/ChatModelSheet.js';import {isFillComplete,firstUnfilledBlank,startFill,filledPrompt,answerBlank,nextEmptyBlank,blankLabel}from'../../features/chat/promptBlanks.js';import {PromptFillBar}from'../../features/chat/PromptFillBar.js';import {HomeSky}from'../../features/home/sky/HomeSky.js';import {setHomeSkyBar}from'../../features/home/sky/homeSkyBar.js';import {useSkyScene}from'../../features/home/sky/useSkyScene.js';import {useHomeWeather}from'../../features/home/useHomeWeather.js';import {BuildKindPicker,BuildGroupTabs}from'./components/BuildKindPicker.js';import {buildPalette}from'./components/buildTheme.js';import {BuildTemplatesSection}from'./components/BuildTemplatesSection.js';import {ChooseTemplateModal}from'./components/ChooseTemplateModal.js';import {TemplateSuggestionBanner}from'./components/TemplateSuggestionBanner.js';import {SUGGEST_MIN_QUERY,suggestTemplateGroup,SUGGEST_DEBOUNCE_MS}from'../../features/templates/templateSuggestion.js';import {HomeHero}from'./components/HomeHero.js';import {FreeCreditsCard}from'../../features/credits/FreeCreditsCard.js';import {shouldOfferFreeCredits}from'../../features/credits/freeCredits.js';import {useFreeCredits}from'../../features/credits/useFreeCredits.js';import {HomeSuggestions}from'./components/HomeSuggestions.js';import {HomeWash}from'./components/HomeWash.js';import {WebBuilderPrewarm}from'./components/WebBuilderPrewarm.js';import {CanvasPrewarm}from'./components/CanvasPrewarm.js';import {WebBuilderCodePrewarm}from'./components/WebBuilderCodePrewarm.js';import {resetDrawerClosed,dispatchDrawerAction,afterNativeModalClose}from'../../utils/drawerNavigation.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -94,11 +94,27 @@ function HomeScreenContent({
|
|
|
94
94
|
const inputRef = useRef(null);
|
|
95
95
|
const [composerEpoch, setComposerEpoch] = useState(0);
|
|
96
96
|
const clearComposerOnFocusRef = useRef(false);
|
|
97
|
+
const shortcutTemplateRef = useRef(null);
|
|
98
|
+
const shortcutAppRef = useRef(null);
|
|
99
|
+
const [blankHint, setBlankHint] = useState(null);
|
|
100
|
+
const [fill, setFill] = useState(null);
|
|
101
|
+
const selectComposerRange = useCallback((start, end) => {
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
const input = inputRef.current;
|
|
104
|
+
if (!input) return;
|
|
105
|
+
input.setSelection(start, end);
|
|
106
|
+
input.focus();
|
|
107
|
+
}, 60);
|
|
108
|
+
}, []);
|
|
97
109
|
const resetComposer = useCallback(() => {
|
|
98
110
|
var _a2;
|
|
99
111
|
setValue("");
|
|
100
112
|
setComposerEpoch((n) => n + 1);
|
|
101
113
|
(_a2 = inputRef.current) == null ? void 0 : _a2.clear();
|
|
114
|
+
shortcutTemplateRef.current = null;
|
|
115
|
+
shortcutAppRef.current = null;
|
|
116
|
+
setBlankHint(null);
|
|
117
|
+
setFill(null);
|
|
102
118
|
}, []);
|
|
103
119
|
useFocusEffect(useCallback(() => {
|
|
104
120
|
var _a2, _b2;
|
|
@@ -291,18 +307,16 @@ function HomeScreenContent({
|
|
|
291
307
|
setSelectedBuildTemplate(null);
|
|
292
308
|
}
|
|
293
309
|
}, []);
|
|
294
|
-
const navigateToChat = useCallback((channelId, query, mode, attachments) => {
|
|
310
|
+
const navigateToChat = useCallback((channelId, query, mode, attachments, app) => {
|
|
295
311
|
var _a2;
|
|
296
|
-
const params = {
|
|
312
|
+
const params = __spreadValues({
|
|
297
313
|
channelId,
|
|
298
314
|
orgName: (_a2 = effectiveOrgName != null ? effectiveOrgName : routeOrgName) != null ? _a2 : void 0,
|
|
299
315
|
initialQuery: query,
|
|
300
316
|
initialMode: mode
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
// two seconds after Send.
|
|
305
|
-
};
|
|
317
|
+
}, app ? {
|
|
318
|
+
initialApp: app
|
|
319
|
+
} : {});
|
|
306
320
|
if (attachments && attachments.length > 0) {
|
|
307
321
|
params.initialAttachments = attachments;
|
|
308
322
|
}
|
|
@@ -363,8 +377,20 @@ function HomeScreenContent({
|
|
|
363
377
|
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
364
378
|
}, []);
|
|
365
379
|
const handleSubmit = useCallback(async () => {
|
|
366
|
-
var _a2;
|
|
380
|
+
var _a2, _b2;
|
|
367
381
|
if (!canSubmit || isLoading || disabled) return;
|
|
382
|
+
if (fill && !isFillComplete(fill)) {
|
|
383
|
+
setSendWhenReady(false);
|
|
384
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const blank = fill ? null : firstUnfilledBlank(value, shortcutTemplateRef.current);
|
|
388
|
+
if (blank) {
|
|
389
|
+
setSendWhenReady(false);
|
|
390
|
+
setBlankHint(blank.text);
|
|
391
|
+
selectComposerRange(blank.start, blank.end);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
368
394
|
if (!workspaceReady) {
|
|
369
395
|
setSendWhenReady(true);
|
|
370
396
|
return;
|
|
@@ -387,7 +413,8 @@ function HomeScreenContent({
|
|
|
387
413
|
console.warn("[HomeScreen] projectId not ready \u2014 using testing project fallback for submit.");
|
|
388
414
|
}
|
|
389
415
|
const queryToForward = trimmedQuery;
|
|
390
|
-
const
|
|
416
|
+
const shortcutApp = shortcutAppRef.current;
|
|
417
|
+
const isRemix = activeMode === "build" && Boolean((_b2 = selectedBuildTemplate == null ? void 0 : selectedBuildTemplate.snapshotId) == null ? void 0 : _b2.trim());
|
|
391
418
|
const kindBuildsSite = !pickedKind || pickedKind === "website" || pickedKind === "app";
|
|
392
419
|
const routedGroup = selectedTemplateGroup != null ? selectedTemplateGroup : suggestedGroupId;
|
|
393
420
|
const buildAsChat = activeMode === "build" && !isRemix && (routedGroup ? routedGroup !== CODE_ASSISTANT_GROUP : !kindBuildsSite);
|
|
@@ -435,8 +462,8 @@ function HomeScreenContent({
|
|
|
435
462
|
});
|
|
436
463
|
}
|
|
437
464
|
setSelectedBuildTemplate(null);
|
|
438
|
-
navigateToChat(requestedChannelId, queryToForward, sendMode);
|
|
439
|
-
}, [canSubmit, workspaceReady, isLoading, disabled, activeMode, trimmedQuery, onSubmitProp, effectiveOrgName, effectiveProjectId, createChannel, navigateToChat, selectedBuildTemplate, selectedTemplateGroup, suggestedGroupId, pickedKind, composerAttachments, resetComposer, navigation]);
|
|
465
|
+
navigateToChat(requestedChannelId, queryToForward, sendMode, void 0, shortcutApp);
|
|
466
|
+
}, [value, selectComposerRange, canSubmit, workspaceReady, isLoading, disabled, activeMode, trimmedQuery, onSubmitProp, effectiveOrgName, effectiveProjectId, createChannel, navigateToChat, selectedBuildTemplate, selectedTemplateGroup, suggestedGroupId, pickedKind, composerAttachments, resetComposer, navigation]);
|
|
440
467
|
const surfaceColor = isDark ? "#0f172a" : mobileTokens.color.surface;
|
|
441
468
|
const authUser = useSelector(userSelector);
|
|
442
469
|
const firstName = useMemo(() => pickGivenName(authUser), [authUser]);
|
|
@@ -544,14 +571,71 @@ function HomeScreenContent({
|
|
|
544
571
|
}));
|
|
545
572
|
}, [dispatch, navigation, route == null ? void 0 : route.name, route == null ? void 0 : route.params, (_j = route == null ? void 0 : route.params) == null ? void 0 : _j.orgName, resolvedOrgName, accountUserId, mobileRoutePath, orgLoading]);
|
|
546
573
|
const handleValueChange = useCallback((e) => {
|
|
547
|
-
|
|
574
|
+
const {
|
|
575
|
+
text
|
|
576
|
+
} = e.nativeEvent;
|
|
577
|
+
setValue(text);
|
|
578
|
+
if (!text.trim()) {
|
|
579
|
+
shortcutTemplateRef.current = null;
|
|
580
|
+
shortcutAppRef.current = null;
|
|
581
|
+
}
|
|
582
|
+
setBlankHint((hint) => hint && firstUnfilledBlank(text, shortcutTemplateRef.current) ? hint : null);
|
|
548
583
|
}, []);
|
|
549
|
-
const handleInjectPrompt = useCallback((prompt, mode) => {
|
|
584
|
+
const handleInjectPrompt = useCallback((prompt, mode, app, guides) => {
|
|
550
585
|
setValue(prompt);
|
|
551
|
-
|
|
586
|
+
handleModeSwitch(mode != null ? mode : "chat");
|
|
587
|
+
shortcutTemplateRef.current = prompt;
|
|
588
|
+
shortcutAppRef.current = app != null ? app : null;
|
|
589
|
+
setBlankHint(null);
|
|
590
|
+
const started = startFill(prompt, guides);
|
|
591
|
+
setFill(started);
|
|
592
|
+
if (started) setTimeout(() => {
|
|
593
|
+
var _a2;
|
|
594
|
+
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
595
|
+
}, 60);
|
|
596
|
+
}, [handleModeSwitch]);
|
|
597
|
+
const applyFill = useCallback((next) => {
|
|
598
|
+
setFill(next);
|
|
599
|
+
setValue(filledPrompt(next));
|
|
552
600
|
}, []);
|
|
601
|
+
const handleFillChange = useCallback((e) => {
|
|
602
|
+
if (fill) applyFill(answerBlank(fill, e.nativeEvent.text));
|
|
603
|
+
}, [fill, applyFill]);
|
|
604
|
+
const handlePickAnswer = useCallback((answer) => {
|
|
605
|
+
var _a2;
|
|
606
|
+
if (!fill) return;
|
|
607
|
+
const answered = answerBlank(fill, answer);
|
|
608
|
+
const next = nextEmptyBlank(answered);
|
|
609
|
+
applyFill(next >= 0 ? __spreadProps(__spreadValues({}, answered), {
|
|
610
|
+
active: next
|
|
611
|
+
}) : answered);
|
|
612
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
613
|
+
}, [fill, applyFill]);
|
|
614
|
+
const handleSelectBlank = useCallback((index) => {
|
|
615
|
+
var _a2;
|
|
616
|
+
setFill((current) => current ? __spreadProps(__spreadValues({}, current), {
|
|
617
|
+
active: index
|
|
618
|
+
}) : current);
|
|
619
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
620
|
+
}, []);
|
|
621
|
+
const handleEditAllFill = useCallback(() => {
|
|
622
|
+
if (!fill) return;
|
|
623
|
+
const draft = filledPrompt(fill);
|
|
624
|
+
setValue(draft);
|
|
625
|
+
setFill(null);
|
|
626
|
+
const blank = firstUnfilledBlank(draft, fill.template);
|
|
627
|
+
if (blank) selectComposerRange(blank.start, blank.end);
|
|
628
|
+
else setTimeout(() => {
|
|
629
|
+
var _a2;
|
|
630
|
+
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
631
|
+
}, 60);
|
|
632
|
+
}, [fill, selectComposerRange]);
|
|
633
|
+
const handleCancelFill = useCallback(() => {
|
|
634
|
+
Keyboard.dismiss();
|
|
635
|
+
resetComposer();
|
|
636
|
+
}, [resetComposer]);
|
|
553
637
|
const handleMicPress = useCallback(() => {
|
|
554
|
-
if (hasQuery) return;
|
|
638
|
+
if (hasQuery && !fill) return;
|
|
555
639
|
setVoiceError(null);
|
|
556
640
|
Keyboard.dismiss();
|
|
557
641
|
void (async () => {
|
|
@@ -565,13 +649,18 @@ function HomeScreenContent({
|
|
|
565
649
|
}
|
|
566
650
|
setShowAudioRecorder(true);
|
|
567
651
|
})();
|
|
568
|
-
}, [hasQuery]);
|
|
652
|
+
}, [hasQuery, fill]);
|
|
569
653
|
const handleTranscriptionComplete = useCallback((text) => {
|
|
570
654
|
const cleaned = (text != null ? text : "").trim();
|
|
571
655
|
setShowAudioRecorder(false);
|
|
572
656
|
if (!cleaned) return;
|
|
657
|
+
if (fill) {
|
|
658
|
+
const typed = fill.answers[fill.active].trim();
|
|
659
|
+
applyFill(answerBlank(fill, typed ? `${typed} ${cleaned}` : cleaned));
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
573
662
|
setValue((prev) => prev.trim().length > 0 ? `${prev.trim()} ${cleaned}` : cleaned);
|
|
574
|
-
}, []);
|
|
663
|
+
}, [fill, applyFill]);
|
|
575
664
|
const handleRecorderCancel = useCallback(() => {
|
|
576
665
|
setShowAudioRecorder(false);
|
|
577
666
|
}, []);
|
|
@@ -617,20 +706,38 @@ function HomeScreenContent({
|
|
|
617
706
|
}, SEND_WAIT_MS);
|
|
618
707
|
return () => clearTimeout(timer);
|
|
619
708
|
}, [sendWhenReady, canSubmit, workspaceReady, handleSubmit]);
|
|
620
|
-
const inputConfig = useMemo(() =>
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
709
|
+
const inputConfig = useMemo(() => {
|
|
710
|
+
var _a2, _b2;
|
|
711
|
+
return {
|
|
712
|
+
value: fill ? fill.answers[fill.active] : value,
|
|
713
|
+
onChange: fill ? handleFillChange : handleValueChange,
|
|
714
|
+
placeholder: fill ? (_b2 = (_a2 = fill.guides[fill.active]) == null ? void 0 : _a2.ask) != null ? _b2 : blankLabel(fill.blanks[fill.active]) : inputPlaceholder,
|
|
715
|
+
disabled: isLoading || disabled,
|
|
716
|
+
inputRef,
|
|
717
|
+
returnKeyType: fill && nextEmptyBlank(fill) >= 0 ? "next" : "send",
|
|
718
|
+
blurOnSubmit: true,
|
|
719
|
+
onSubmitEditing: () => {
|
|
720
|
+
const next = fill ? nextEmptyBlank(fill) : -1;
|
|
721
|
+
if (fill && next >= 0) {
|
|
722
|
+
setFill(__spreadProps(__spreadValues({}, fill), {
|
|
723
|
+
active: next
|
|
724
|
+
}));
|
|
725
|
+
setTimeout(() => {
|
|
726
|
+
var _a3;
|
|
727
|
+
return (_a3 = inputRef.current) == null ? void 0 : _a3.focus();
|
|
728
|
+
}, 60);
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
if (canSubmit) void handleSubmit();
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}, [fill, value, handleFillChange, handleValueChange, inputPlaceholder, isLoading, disabled, canSubmit, handleSubmit]);
|
|
735
|
+
const blankHintLine = blankHint ? /* @__PURE__ */ jsx(Text, { accessibilityLiveRegion: "polite", style: [styles.blankHint, {
|
|
736
|
+
color: isDark ? "#fcd34d" : "#92400e"
|
|
737
|
+
}], children: `Replace ${blankHint} with yours to send.` }) : null;
|
|
632
738
|
const micSendButton = useMemo(() => ({
|
|
633
|
-
|
|
739
|
+
// Send waits for the blank: until it is answered this stays the mic, as on an empty composer.
|
|
740
|
+
hasContent: fill ? isFillComplete(fill) : hasQuery || hasAttachments,
|
|
634
741
|
onSend: () => {
|
|
635
742
|
Keyboard.dismiss();
|
|
636
743
|
void handleSubmit();
|
|
@@ -638,7 +745,7 @@ function HomeScreenContent({
|
|
|
638
745
|
onMic: handleMicPress,
|
|
639
746
|
disabled: isLoading || disabled,
|
|
640
747
|
isLoading: isLoading || sendWhenReady
|
|
641
|
-
}), [hasQuery, hasAttachments, handleSubmit, handleMicPress, isLoading, disabled, sendWhenReady]);
|
|
748
|
+
}), [fill, hasQuery, hasAttachments, handleSubmit, handleMicPress, isLoading, disabled, sendWhenReady]);
|
|
642
749
|
return /* @__PURE__ */ jsxs(SafeAreaView, { ref: screenRef, collapsable: false, edges: ["left", "right"], style: {
|
|
643
750
|
flex: 1,
|
|
644
751
|
backgroundColor: surfaceColor
|
|
@@ -676,7 +783,7 @@ function HomeScreenContent({
|
|
|
676
783
|
}], children: voiceError || composerAttachments.error }) }) : null,
|
|
677
784
|
showAudioRecorder ? /* @__PURE__ */ jsx(MicErrorBoundary, { onCancel: handleRecorderCancel, onError: handleRecorderError, children: /* @__PURE__ */ jsx(AudioRecorderPanel, { isDark, onTranscriptionComplete: handleTranscriptionComplete, onCancel: handleRecorderCancel, onError: handleRecorderError }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
678
785
|
/* @__PURE__ */ jsx(ComposerAttachmentBar, { attachments: composerAttachments.pending, onRemove: composerAttachments.remove, isDark }),
|
|
679
|
-
/* @__PURE__ */ jsx(InputToolBar, { inputConfig, leftCustomRender: modeSwitch, rightItems, templateButton, topContent: draftReadable ? /* @__PURE__ */ jsx(TemplateSuggestionBanner, { selectedLabel: selectedTemplateGroup ? (_l = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _l : null : null, suggestedLabel: selectedTemplateGroup ? null : (_m = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _m : null, description: bannerGroup == null ? void 0 : bannerGroup.description, isAnalyzing: analyzingQuery, onChange: () => {
|
|
786
|
+
/* @__PURE__ */ jsx(InputToolBar, { inputConfig, leftCustomRender: modeSwitch, rightItems, templateButton, topContent: fill ? /* @__PURE__ */ jsx(PromptFillBar, { fill, isDark, onSelectBlank: handleSelectBlank, onPickAnswer: handlePickAnswer, onEditAll: handleEditAllFill, onCancel: handleCancelFill }) : blankHintLine != null ? blankHintLine : draftReadable ? /* @__PURE__ */ jsx(TemplateSuggestionBanner, { selectedLabel: selectedTemplateGroup ? (_l = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _l : null : null, suggestedLabel: selectedTemplateGroup ? null : (_m = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _m : null, description: bannerGroup == null ? void 0 : bannerGroup.description, isAnalyzing: analyzingQuery, onChange: () => {
|
|
680
787
|
dismissKeyboard();
|
|
681
788
|
setGroupPickerOpen(true);
|
|
682
789
|
}, palette: buildColors }) : null, micSendButton }, composerEpoch)
|
|
@@ -693,6 +800,13 @@ function HomeScreenContent({
|
|
|
693
800
|
] });
|
|
694
801
|
}
|
|
695
802
|
const styles = StyleSheet.create({
|
|
803
|
+
blankHint: {
|
|
804
|
+
fontSize: 13,
|
|
805
|
+
lineHeight: 18,
|
|
806
|
+
fontWeight: "500",
|
|
807
|
+
paddingHorizontal: 4,
|
|
808
|
+
paddingBottom: 6
|
|
809
|
+
},
|
|
696
810
|
flex: {
|
|
697
811
|
flex: 1
|
|
698
812
|
},
|