@timpel/forumkit-sdk-react-native 0.2.5 → 0.2.7
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/dist/index.js +1205 -1213
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(src_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(src_exports);
|
|
36
36
|
|
|
37
37
|
// src/ForumKit.tsx
|
|
38
|
-
var
|
|
38
|
+
var import_react_native51 = require("react-native");
|
|
39
39
|
var import_react_native_safe_area_context11 = require("react-native-safe-area-context");
|
|
40
40
|
var import_inter = require("@expo-google-fonts/inter");
|
|
41
41
|
var import_michroma = require("@expo-google-fonts/michroma");
|
|
@@ -893,13 +893,13 @@ function useSession() {
|
|
|
893
893
|
}
|
|
894
894
|
|
|
895
895
|
// src/navigation/RootNavigator.tsx
|
|
896
|
-
var
|
|
896
|
+
var import_react36 = require("react");
|
|
897
897
|
var import_native11 = require("@react-navigation/native");
|
|
898
898
|
var import_native_stack = require("@react-navigation/native-stack");
|
|
899
899
|
|
|
900
900
|
// src/screens/FeedScreen.tsx
|
|
901
|
-
var
|
|
902
|
-
var
|
|
901
|
+
var import_react24 = require("react");
|
|
902
|
+
var import_react_native37 = require("react-native");
|
|
903
903
|
var import_native4 = require("@react-navigation/native");
|
|
904
904
|
|
|
905
905
|
// src/lib/vote.ts
|
|
@@ -914,8 +914,8 @@ function applyVote(vc, oldDir, newDir) {
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
// src/navigation/Shell.tsx
|
|
917
|
-
var
|
|
918
|
-
var
|
|
917
|
+
var import_react15 = require("react");
|
|
918
|
+
var import_react_native22 = require("react-native");
|
|
919
919
|
var import_react_native_reanimated3 = __toESM(require("react-native-reanimated"));
|
|
920
920
|
var import_react_native_safe_area_context7 = require("react-native-safe-area-context");
|
|
921
921
|
var import_native3 = require("@react-navigation/native");
|
|
@@ -2244,7 +2244,7 @@ var import_react_native_safe_area_context3 = require("react-native-safe-area-con
|
|
|
2244
2244
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2245
2245
|
function ImageLightbox({ uri, onClose }) {
|
|
2246
2246
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
2247
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native12.Modal, { visible: true, transparent: true, animationType: "fade", onRequestClose: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native12.Pressable, { style: styles6.backdrop, onPress: onClose, children: [
|
|
2247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native12.Modal, { visible: true, transparent: true, animationType: "fade", statusBarTranslucent: true, onRequestClose: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native12.Pressable, { style: styles6.backdrop, onPress: onClose, children: [
|
|
2248
2248
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native12.Image, { source: { uri }, style: styles6.image, resizeMode: "contain" }),
|
|
2249
2249
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native12.Pressable, { onPress: onClose, hitSlop: 10, style: [styles6.close, { top: insets.top + 12 }], children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon, { size: 20, color: "#fff" }) })
|
|
2250
2250
|
] }) });
|
|
@@ -2800,8 +2800,8 @@ var styles9 = import_react_native15.StyleSheet.create({
|
|
|
2800
2800
|
});
|
|
2801
2801
|
|
|
2802
2802
|
// src/composer/DraftsSheet.tsx
|
|
2803
|
-
var
|
|
2804
|
-
var
|
|
2803
|
+
var import_react12 = require("react");
|
|
2804
|
+
var import_react_native18 = require("react-native");
|
|
2805
2805
|
|
|
2806
2806
|
// src/lib/sheet-layout.ts
|
|
2807
2807
|
var import_react_native16 = require("react-native");
|
|
@@ -2815,14 +2815,47 @@ function useSheetLayout(basePaddingBottom) {
|
|
|
2815
2815
|
};
|
|
2816
2816
|
}
|
|
2817
2817
|
|
|
2818
|
-
// src/
|
|
2818
|
+
// src/components/BottomSheetShell.tsx
|
|
2819
|
+
var import_react11 = require("react");
|
|
2820
|
+
var import_react_native17 = require("react-native");
|
|
2819
2821
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2822
|
+
function BottomSheetShell({
|
|
2823
|
+
visible,
|
|
2824
|
+
onClose,
|
|
2825
|
+
children,
|
|
2826
|
+
scrimOpacity = 0.5,
|
|
2827
|
+
fadeDuration = 220
|
|
2828
|
+
}) {
|
|
2829
|
+
const { height: windowHeight } = (0, import_react_native17.useWindowDimensions)();
|
|
2830
|
+
const progress = (0, import_react11.useRef)(new import_react_native17.Animated.Value(0)).current;
|
|
2831
|
+
(0, import_react11.useEffect)(() => {
|
|
2832
|
+
import_react_native17.Animated.timing(progress, {
|
|
2833
|
+
toValue: visible ? 1 : 0,
|
|
2834
|
+
duration: fadeDuration,
|
|
2835
|
+
useNativeDriver: true
|
|
2836
|
+
}).start();
|
|
2837
|
+
}, [visible, fadeDuration, progress]);
|
|
2838
|
+
const scrim = progress.interpolate({ inputRange: [0, 1], outputRange: [0, scrimOpacity] });
|
|
2839
|
+
const translateY = progress.interpolate({ inputRange: [0, 1], outputRange: [windowHeight, 0] });
|
|
2840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.Modal, { transparent: true, visible, animationType: "none", statusBarTranslucent: true, onRequestClose: onClose, children: [
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native17.Animated.View, { style: [styles10.scrim, { opacity: scrim }], pointerEvents: "none" }),
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native17.Pressable, { style: import_react_native17.StyleSheet.absoluteFill, onPress: onClose }),
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native17.Animated.View, { style: [styles10.sheetWrap, { transform: [{ translateY }] }], pointerEvents: "box-none", children })
|
|
2844
|
+
] });
|
|
2845
|
+
}
|
|
2846
|
+
var styles10 = import_react_native17.StyleSheet.create({
|
|
2847
|
+
scrim: { ...import_react_native17.StyleSheet.absoluteFill, backgroundColor: "#000" },
|
|
2848
|
+
sheetWrap: { flex: 1, justifyContent: "flex-end" }
|
|
2849
|
+
});
|
|
2850
|
+
|
|
2851
|
+
// src/composer/DraftsSheet.tsx
|
|
2852
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2820
2853
|
function DraftsSheet({ apiUrl, forumId, token, onClose, onOpen }) {
|
|
2821
2854
|
const { tokens } = useTheme();
|
|
2822
2855
|
const { maxHeight, paddingBottom } = useSheetLayout(28);
|
|
2823
|
-
const [drafts, setDrafts] = (0,
|
|
2824
|
-
const [loading, setLoading] = (0,
|
|
2825
|
-
(0,
|
|
2856
|
+
const [drafts, setDrafts] = (0, import_react12.useState)([]);
|
|
2857
|
+
const [loading, setLoading] = (0, import_react12.useState)(true);
|
|
2858
|
+
(0, import_react12.useEffect)(() => {
|
|
2826
2859
|
if (!token) return;
|
|
2827
2860
|
let cancelled = false;
|
|
2828
2861
|
setLoading(true);
|
|
@@ -2842,30 +2875,28 @@ function DraftsSheet({ apiUrl, forumId, token, onClose, onOpen }) {
|
|
|
2842
2875
|
if (token) void deleteDraft(apiUrl, forumId, id, token).catch(() => {
|
|
2843
2876
|
});
|
|
2844
2877
|
}
|
|
2845
|
-
return /* @__PURE__ */ (0,
|
|
2846
|
-
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2849
|
-
|
|
2850
|
-
import_react_native17.FlatList,
|
|
2878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BottomSheetShell, { visible: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native18.View, { style: [styles11.sheet, { backgroundColor: tokens.elev, borderColor: tokens.border, maxHeight, paddingBottom }], children: [
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.Text, { style: [styles11.title, { color: tokens.text }], children: "Drafts" }),
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.Text, { style: [styles11.note, { color: tokens.muted }], children: "Media isn\u2019t saved in drafts." }),
|
|
2881
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.View, { style: { alignItems: "center", padding: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Mascot, { size: 36 }) }) : drafts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.Text, { style: { color: tokens["text-2"], padding: 12 }, children: "No drafts yet" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2882
|
+
import_react_native18.FlatList,
|
|
2851
2883
|
{
|
|
2852
2884
|
data: drafts,
|
|
2853
2885
|
keyExtractor: (d) => d.id,
|
|
2854
2886
|
style: { maxHeight: 320 },
|
|
2855
|
-
renderItem: ({ item }) => /* @__PURE__ */ (0,
|
|
2856
|
-
/* @__PURE__ */ (0,
|
|
2857
|
-
/* @__PURE__ */ (0,
|
|
2858
|
-
item.content.body ? /* @__PURE__ */ (0,
|
|
2859
|
-
/* @__PURE__ */ (0,
|
|
2887
|
+
renderItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native18.Pressable, { onPress: () => onOpen(item), style: [styles11.row, { borderTopColor: tokens.border }], children: [
|
|
2888
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native18.View, { style: { flex: 1 }, children: [
|
|
2889
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.Text, { style: [styles11.dTitle, { color: tokens.text }], numberOfLines: 1, children: item.title || "Untitled" }),
|
|
2890
|
+
item.content.body ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.Text, { style: [styles11.dBody, { color: tokens["text-2"] }], numberOfLines: 1, children: item.content.body }) : null,
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.Text, { style: [styles11.dTime, { color: tokens.muted }], children: fmtRelativeTime(item.updatedAt) })
|
|
2860
2892
|
] }),
|
|
2861
|
-
/* @__PURE__ */ (0,
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.Pressable, { onPress: () => remove(item.id), hitSlop: 8, style: [styles11.del, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseIcon, { size: 14, color: tokens["text-2"] }) })
|
|
2862
2894
|
] })
|
|
2863
2895
|
}
|
|
2864
2896
|
)
|
|
2865
|
-
] }) })
|
|
2897
|
+
] }) });
|
|
2866
2898
|
}
|
|
2867
|
-
var
|
|
2868
|
-
scrim: { flex: 1, backgroundColor: "rgba(0,0,0,0.5)", justifyContent: "flex-end" },
|
|
2899
|
+
var styles11 = import_react_native18.StyleSheet.create({
|
|
2869
2900
|
sheet: { borderTopWidth: 1, borderTopLeftRadius: 18, borderTopRightRadius: 18, paddingHorizontal: 16, paddingTop: 16 },
|
|
2870
2901
|
title: { fontSize: 16, fontWeight: "800" },
|
|
2871
2902
|
note: { fontSize: 12, marginTop: 4, marginBottom: 8 },
|
|
@@ -2877,48 +2908,48 @@ var styles10 = import_react_native17.StyleSheet.create({
|
|
|
2877
2908
|
});
|
|
2878
2909
|
|
|
2879
2910
|
// src/navigation/NotificationsOverlay.tsx
|
|
2880
|
-
var
|
|
2881
|
-
var
|
|
2911
|
+
var import_react14 = require("react");
|
|
2912
|
+
var import_react_native21 = require("react-native");
|
|
2882
2913
|
var import_react_native_safe_area_context6 = require("react-native-safe-area-context");
|
|
2883
2914
|
var import_native2 = require("@react-navigation/native");
|
|
2884
2915
|
|
|
2885
2916
|
// src/notifications/NotificationSettingsSheet.tsx
|
|
2886
|
-
var
|
|
2887
|
-
var
|
|
2917
|
+
var import_react13 = require("react");
|
|
2918
|
+
var import_react_native20 = require("react-native");
|
|
2888
2919
|
|
|
2889
2920
|
// src/components/Toggle.tsx
|
|
2890
|
-
var
|
|
2891
|
-
var
|
|
2921
|
+
var import_react_native19 = require("react-native");
|
|
2922
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2892
2923
|
function Toggle({ value, onValueChange }) {
|
|
2893
2924
|
const { tokens } = useTheme();
|
|
2894
|
-
return /* @__PURE__ */ (0,
|
|
2895
|
-
|
|
2925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2926
|
+
import_react_native19.Pressable,
|
|
2896
2927
|
{
|
|
2897
2928
|
onPress: onValueChange,
|
|
2898
2929
|
hitSlop: 6,
|
|
2899
2930
|
style: [
|
|
2900
|
-
|
|
2931
|
+
styles12.track,
|
|
2901
2932
|
{ backgroundColor: value ? tokens.accent : tokens["surface-2"], borderColor: value ? tokens.accent : tokens["border-strong"] }
|
|
2902
2933
|
],
|
|
2903
|
-
children: /* @__PURE__ */ (0,
|
|
2934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native19.View, { style: [styles12.knob, { backgroundColor: value ? "#fff" : tokens.text }, value && styles12.knobOn] })
|
|
2904
2935
|
}
|
|
2905
2936
|
);
|
|
2906
2937
|
}
|
|
2907
|
-
var
|
|
2938
|
+
var styles12 = import_react_native19.StyleSheet.create({
|
|
2908
2939
|
track: { width: 40, height: 24, borderRadius: 999, borderWidth: 1, padding: 2, justifyContent: "center" },
|
|
2909
2940
|
knob: { width: 18, height: 18, borderRadius: 9 },
|
|
2910
2941
|
knobOn: { transform: [{ translateX: 16 }] }
|
|
2911
2942
|
});
|
|
2912
2943
|
|
|
2913
2944
|
// src/notifications/NotificationSettingsSheet.tsx
|
|
2914
|
-
var
|
|
2945
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2915
2946
|
function NotificationSettingsSheet({ apiUrl, forumId, token, onClose }) {
|
|
2916
2947
|
const { tokens } = useTheme();
|
|
2917
2948
|
const { maxHeight, paddingBottom } = useSheetLayout(28);
|
|
2918
|
-
const [prefs, setPrefs] = (0,
|
|
2919
|
-
const [isMod, setIsMod] = (0,
|
|
2920
|
-
const [loading, setLoading] = (0,
|
|
2921
|
-
(0,
|
|
2949
|
+
const [prefs, setPrefs] = (0, import_react13.useState)(null);
|
|
2950
|
+
const [isMod, setIsMod] = (0, import_react13.useState)(false);
|
|
2951
|
+
const [loading, setLoading] = (0, import_react13.useState)(true);
|
|
2952
|
+
(0, import_react13.useEffect)(() => {
|
|
2922
2953
|
if (!token) return;
|
|
2923
2954
|
let cancelled = false;
|
|
2924
2955
|
getMyProfile(apiUrl, forumId, token).then((p) => {
|
|
@@ -2941,20 +2972,18 @@ function NotificationSettingsSheet({ apiUrl, forumId, token, onClose }) {
|
|
|
2941
2972
|
void updateNotificationPrefs(apiUrl, forumId, next, token).catch(() => setPrefs(prev));
|
|
2942
2973
|
}
|
|
2943
2974
|
const rows = NOTIFICATION_PREF_ROWS.filter((r) => !r.modOnly || isMod);
|
|
2944
|
-
return /* @__PURE__ */ (0,
|
|
2945
|
-
|
|
2946
|
-
/* @__PURE__ */ (0,
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
/* @__PURE__ */ (0,
|
|
2950
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native19.Text, { style: [styles12.sub, { color: tokens.muted }], children: row.sub })
|
|
2975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BottomSheetShell, { visible: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native20.View, { style: [styles13.sheet, { backgroundColor: tokens.elev, borderColor: tokens.border, maxHeight, paddingBottom }], children: [
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native20.Text, { style: [styles13.title, { color: tokens.text }], children: "Notification settings" }),
|
|
2977
|
+
loading || !prefs ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native20.ActivityIndicator, { color: tokens.accent, style: { padding: 16 } }) : rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native20.View, { style: [styles13.row, i < rows.length - 1 && { marginBottom: 22 }], children: [
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native20.View, { style: { flex: 1, paddingRight: 12 }, children: [
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native20.Text, { style: [styles13.label, { color: tokens.text }], children: row.label }),
|
|
2980
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native20.Text, { style: [styles13.sub, { color: tokens.muted }], children: row.sub })
|
|
2951
2981
|
] }),
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
2982
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Toggle, { value: prefs[row.key], onValueChange: () => toggle(row.key) })
|
|
2953
2983
|
] }, row.key))
|
|
2954
|
-
] }) })
|
|
2984
|
+
] }) });
|
|
2955
2985
|
}
|
|
2956
|
-
var
|
|
2957
|
-
scrim: { flex: 1, backgroundColor: "rgba(0,0,0,0.5)", justifyContent: "flex-end" },
|
|
2986
|
+
var styles13 = import_react_native20.StyleSheet.create({
|
|
2958
2987
|
sheet: { borderTopWidth: 1, borderTopLeftRadius: 18, borderTopRightRadius: 18, paddingHorizontal: 16, paddingTop: 16 },
|
|
2959
2988
|
title: { fontSize: 16, fontWeight: "800", marginBottom: 8 },
|
|
2960
2989
|
row: { flexDirection: "row", alignItems: "center" },
|
|
@@ -2963,8 +2992,8 @@ var styles12 = import_react_native19.StyleSheet.create({
|
|
|
2963
2992
|
});
|
|
2964
2993
|
|
|
2965
2994
|
// src/navigation/NotificationsOverlay.tsx
|
|
2966
|
-
var
|
|
2967
|
-
var ANDROID_TOP_EXTRA3 =
|
|
2995
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2996
|
+
var ANDROID_TOP_EXTRA3 = import_react_native21.Platform.OS === "android" ? 12 : 0;
|
|
2968
2997
|
function badgeFor(n) {
|
|
2969
2998
|
if (n.type === "vote") {
|
|
2970
2999
|
return n.message === "down" ? { Icon: DownvoteIcon, color: "#7d3fbd" } : { Icon: UpvoteIcon, color: "#c0431a" };
|
|
@@ -2985,14 +3014,14 @@ function NotificationsOverlay({ onClose }) {
|
|
|
2985
3014
|
const insets = (0, import_react_native_safe_area_context6.useSafeAreaInsets)();
|
|
2986
3015
|
const session = useSession();
|
|
2987
3016
|
const navigation = (0, import_native2.useNavigation)();
|
|
2988
|
-
const BackIcon =
|
|
3017
|
+
const BackIcon = import_react_native21.Platform.OS === "ios" ? ChevronLeftIcon : MaterialBackIcon;
|
|
2989
3018
|
const { apiUrl, forumId } = session;
|
|
2990
3019
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
2991
|
-
const [items, setItems] = (0,
|
|
2992
|
-
const [loading, setLoading] = (0,
|
|
2993
|
-
const [error, setError] = (0,
|
|
2994
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
2995
|
-
(0,
|
|
3020
|
+
const [items, setItems] = (0, import_react14.useState)([]);
|
|
3021
|
+
const [loading, setLoading] = (0, import_react14.useState)(true);
|
|
3022
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
3023
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react14.useState)(false);
|
|
3024
|
+
(0, import_react14.useEffect)(() => {
|
|
2996
3025
|
if (!token) return;
|
|
2997
3026
|
let cancelled = false;
|
|
2998
3027
|
setLoading(true);
|
|
@@ -3020,7 +3049,7 @@ function NotificationsOverlay({ onClose }) {
|
|
|
3020
3049
|
}
|
|
3021
3050
|
}
|
|
3022
3051
|
function handleDelete(n) {
|
|
3023
|
-
|
|
3052
|
+
import_react_native21.Alert.alert("Delete notification?", "", [
|
|
3024
3053
|
{ text: "Cancel", style: "cancel" },
|
|
3025
3054
|
{
|
|
3026
3055
|
text: "Delete",
|
|
@@ -3040,10 +3069,10 @@ function NotificationsOverlay({ onClose }) {
|
|
|
3040
3069
|
});
|
|
3041
3070
|
}
|
|
3042
3071
|
const hasUnread = items.some((n) => !n.readAt);
|
|
3043
|
-
const SCREEN_WIDTH =
|
|
3044
|
-
const translateX = (0,
|
|
3045
|
-
const swipePan = (0,
|
|
3046
|
-
|
|
3072
|
+
const SCREEN_WIDTH = import_react_native21.Dimensions.get("window").width;
|
|
3073
|
+
const translateX = (0, import_react14.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
3074
|
+
const swipePan = (0, import_react14.useRef)(
|
|
3075
|
+
import_react_native21.PanResponder.create({
|
|
3047
3076
|
onMoveShouldSetPanResponder: (_evt, gesture) => gesture.dx > 8 && Math.abs(gesture.dx) > Math.abs(gesture.dy),
|
|
3048
3077
|
onPanResponderMove: (_evt, gesture) => {
|
|
3049
3078
|
if (gesture.dx > 0) translateX.setValue(gesture.dx);
|
|
@@ -3051,46 +3080,46 @@ function NotificationsOverlay({ onClose }) {
|
|
|
3051
3080
|
onPanResponderRelease: (_evt, gesture) => {
|
|
3052
3081
|
const shouldClose = gesture.dx > SCREEN_WIDTH / 3 || gesture.vx > 0.5;
|
|
3053
3082
|
if (shouldClose) {
|
|
3054
|
-
|
|
3083
|
+
import_react_native21.Animated.timing(translateX, { toValue: SCREEN_WIDTH, duration: 180, useNativeDriver: true }).start(() => onClose());
|
|
3055
3084
|
} else {
|
|
3056
|
-
|
|
3085
|
+
import_react_native21.Animated.spring(translateX, { toValue: 0, useNativeDriver: true, bounciness: 0 }).start();
|
|
3057
3086
|
}
|
|
3058
3087
|
},
|
|
3059
3088
|
onPanResponderTerminate: () => {
|
|
3060
|
-
|
|
3089
|
+
import_react_native21.Animated.spring(translateX, { toValue: 0, useNativeDriver: true, bounciness: 0 }).start();
|
|
3061
3090
|
}
|
|
3062
3091
|
})
|
|
3063
3092
|
).current;
|
|
3064
|
-
return /* @__PURE__ */ (0,
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3066
|
-
/* @__PURE__ */ (0,
|
|
3067
|
-
/* @__PURE__ */ (0,
|
|
3068
|
-
/* @__PURE__ */ (0,
|
|
3069
|
-
hasUnread && /* @__PURE__ */ (0,
|
|
3070
|
-
/* @__PURE__ */ (0,
|
|
3093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native21.Animated.View, { style: [styles14.overlay, { backgroundColor: tokens.bg, transform: [{ translateX }] }], ...swipePan.panHandlers, children: [
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.View, { style: { paddingTop: insets.top + ANDROID_TOP_EXTRA3, borderBottomWidth: 1, borderBottomColor: tokens.border }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native21.View, { style: styles14.header, children: [
|
|
3095
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Pressable, { onPress: onClose, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BackIcon, { size: 20, color: tokens.text }) }),
|
|
3096
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Text, { style: [styles14.title, { color: tokens.text }], children: "Notifications" }),
|
|
3097
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.View, { style: { flex: 1 } }),
|
|
3098
|
+
hasUnread && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Pressable, { onPress: handleMarkAllRead, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Text, { style: { color: tokens.accent, fontSize: 13, fontWeight: "600" }, children: "Mark all read" }) }),
|
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Pressable, { onPress: () => setSettingsOpen(true), hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(GearIcon, { size: 20, color: tokens["text-2"] }) })
|
|
3071
3100
|
] }) }),
|
|
3072
|
-
loading ? /* @__PURE__ */ (0,
|
|
3073
|
-
|
|
3101
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.View, { style: styles14.center, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Mascot, { size: 32 }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.View, { style: styles14.center, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Text, { style: { color: tokens["text-2"] }, children: error }) }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.View, { style: styles14.center, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Text, { style: { color: tokens["text-2"] }, children: "No notifications yet" }) }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3102
|
+
import_react_native21.FlatList,
|
|
3074
3103
|
{
|
|
3075
3104
|
data: items,
|
|
3076
3105
|
keyExtractor: (n) => n.id,
|
|
3077
3106
|
renderItem: ({ item, index }) => {
|
|
3078
3107
|
const badge = badgeFor(item);
|
|
3079
3108
|
const unread = !item.readAt;
|
|
3080
|
-
return /* @__PURE__ */ (0,
|
|
3081
|
-
|
|
3109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3110
|
+
import_react_native21.Pressable,
|
|
3082
3111
|
{
|
|
3083
3112
|
onPress: () => handleOpen(item),
|
|
3084
3113
|
onLongPress: () => handleDelete(item),
|
|
3085
|
-
style: [
|
|
3114
|
+
style: [styles14.row, index > 0 && { borderTopWidth: 1, borderTopColor: tokens.border }, unread && { backgroundColor: tokens.hover }],
|
|
3086
3115
|
children: [
|
|
3087
|
-
/* @__PURE__ */ (0,
|
|
3088
|
-
/* @__PURE__ */ (0,
|
|
3089
|
-
/* @__PURE__ */ (0,
|
|
3116
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native21.View, { style: styles14.avatarWrap, children: [
|
|
3117
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Avatar, { authorId: item.actorId ?? void 0, author: item.actorDisplayName ?? "Someone", avatarUrl: item.actorAvatarUrl, size: 34 }),
|
|
3118
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.View, { style: [styles14.badge, { backgroundColor: badge.color, borderColor: tokens.bg }], children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(badge.Icon, { size: 9, color: "#ffffff" }) })
|
|
3090
3119
|
] }),
|
|
3091
|
-
/* @__PURE__ */ (0,
|
|
3092
|
-
item.threadImageUrl != null && /* @__PURE__ */ (0,
|
|
3093
|
-
/* @__PURE__ */ (0,
|
|
3120
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Text, { style: [styles14.text, { color: tokens["text-2"] }], children: describeNotification(item) }),
|
|
3121
|
+
item.threadImageUrl != null && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Image, { source: { uri: item.threadImageUrl }, style: [styles14.thumb, { backgroundColor: tokens["surface-2"] }] }),
|
|
3122
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native21.Text, { style: [styles14.time, { color: tokens.muted }], children: fmtRelativeTime(item.createdAt) })
|
|
3094
3123
|
]
|
|
3095
3124
|
}
|
|
3096
3125
|
);
|
|
@@ -3098,10 +3127,10 @@ function NotificationsOverlay({ onClose }) {
|
|
|
3098
3127
|
contentContainerStyle: { paddingBottom: 24 }
|
|
3099
3128
|
}
|
|
3100
3129
|
),
|
|
3101
|
-
settingsOpen && /* @__PURE__ */ (0,
|
|
3130
|
+
settingsOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(NotificationSettingsSheet, { apiUrl, forumId, token, onClose: () => setSettingsOpen(false) })
|
|
3102
3131
|
] });
|
|
3103
3132
|
}
|
|
3104
|
-
var
|
|
3133
|
+
var styles14 = import_react_native21.StyleSheet.create({
|
|
3105
3134
|
overlay: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, zIndex: 65 },
|
|
3106
3135
|
header: { height: 52, flexDirection: "row", alignItems: "center", gap: 14, paddingHorizontal: 16 },
|
|
3107
3136
|
title: { fontSize: 16, fontWeight: "800" },
|
|
@@ -3115,12 +3144,12 @@ var styles13 = import_react_native20.StyleSheet.create({
|
|
|
3115
3144
|
});
|
|
3116
3145
|
|
|
3117
3146
|
// src/navigation/Shell.tsx
|
|
3118
|
-
var
|
|
3119
|
-
var ANDROID_TOP_EXTRA4 =
|
|
3147
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3148
|
+
var ANDROID_TOP_EXTRA4 = import_react_native22.Platform.OS === "android" ? 12 : 0;
|
|
3120
3149
|
var _globalAskRef = null;
|
|
3121
|
-
var ShellContext = (0,
|
|
3150
|
+
var ShellContext = (0, import_react15.createContext)(null);
|
|
3122
3151
|
function useShell() {
|
|
3123
|
-
const ctx = (0,
|
|
3152
|
+
const ctx = (0, import_react15.useContext)(ShellContext);
|
|
3124
3153
|
if (!ctx) throw new Error("useShell must be used within a Shell");
|
|
3125
3154
|
return ctx;
|
|
3126
3155
|
}
|
|
@@ -3135,19 +3164,19 @@ function Shell({ children }) {
|
|
|
3135
3164
|
const { apiUrl, forumId } = session;
|
|
3136
3165
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
3137
3166
|
const isModerator = session.status === "ready" && (session.role === "moderator" || session.role === "admin");
|
|
3138
|
-
const [drawerOpen, setDrawerOpen] = (0,
|
|
3139
|
-
const [composerOpen, setComposerOpen] = (0,
|
|
3140
|
-
const [notifOpen, setNotifOpen] = (0,
|
|
3141
|
-
const [draftsOpen, setDraftsOpen] = (0,
|
|
3142
|
-
const [loadedDraft, setLoadedDraft] = (0,
|
|
3143
|
-
const [bottomBarCollapsed, setBottomBarCollapsed] = (0,
|
|
3167
|
+
const [drawerOpen, setDrawerOpen] = (0, import_react15.useState)(false);
|
|
3168
|
+
const [composerOpen, setComposerOpen] = (0, import_react15.useState)(false);
|
|
3169
|
+
const [notifOpen, setNotifOpen] = (0, import_react15.useState)(false);
|
|
3170
|
+
const [draftsOpen, setDraftsOpen] = (0, import_react15.useState)(false);
|
|
3171
|
+
const [loadedDraft, setLoadedDraft] = (0, import_react15.useState)(null);
|
|
3172
|
+
const [bottomBarCollapsed, setBottomBarCollapsed] = (0, import_react15.useState)(false);
|
|
3144
3173
|
const drawerX = (0, import_react_native_reanimated3.useSharedValue)(0);
|
|
3145
|
-
(0,
|
|
3174
|
+
(0, import_react15.useEffect)(() => {
|
|
3146
3175
|
drawerX.value = (0, import_react_native_reanimated3.withTiming)(drawerOpen ? DRAWER_WIDTH : 0, { duration: 250, easing: import_react_native_reanimated3.Easing.out(import_react_native_reanimated3.Easing.cubic) });
|
|
3147
3176
|
}, [drawerOpen, drawerX]);
|
|
3148
3177
|
const drawerPushStyle = (0, import_react_native_reanimated3.useAnimatedStyle)(() => ({ transform: [{ translateX: drawerX.value }] }));
|
|
3149
|
-
const closeDrawerResponder = (0,
|
|
3150
|
-
|
|
3178
|
+
const closeDrawerResponder = (0, import_react15.useRef)(
|
|
3179
|
+
import_react_native22.PanResponder.create({
|
|
3151
3180
|
onStartShouldSetPanResponder: () => true,
|
|
3152
3181
|
onMoveShouldSetPanResponder: () => true,
|
|
3153
3182
|
onPanResponderMove: (_evt, gesture) => {
|
|
@@ -3167,8 +3196,8 @@ function Shell({ children }) {
|
|
|
3167
3196
|
}
|
|
3168
3197
|
})
|
|
3169
3198
|
).current;
|
|
3170
|
-
const openDrawerResponder = (0,
|
|
3171
|
-
|
|
3199
|
+
const openDrawerResponder = (0, import_react15.useRef)(
|
|
3200
|
+
import_react_native22.PanResponder.create({
|
|
3172
3201
|
onStartShouldSetPanResponder: () => false,
|
|
3173
3202
|
onMoveShouldSetPanResponder: (_evt, gesture) => gesture.dx > 8 && Math.abs(gesture.dx) > Math.abs(gesture.dy),
|
|
3174
3203
|
onPanResponderMove: (_evt, gesture) => {
|
|
@@ -3188,9 +3217,9 @@ function Shell({ children }) {
|
|
|
3188
3217
|
}
|
|
3189
3218
|
})
|
|
3190
3219
|
).current;
|
|
3191
|
-
(0,
|
|
3220
|
+
(0, import_react15.useEffect)(() => {
|
|
3192
3221
|
if (!drawerOpen) return;
|
|
3193
|
-
const sub =
|
|
3222
|
+
const sub = import_react_native22.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
3194
3223
|
setDrawerOpen(false);
|
|
3195
3224
|
return true;
|
|
3196
3225
|
});
|
|
@@ -3211,7 +3240,7 @@ function Shell({ children }) {
|
|
|
3211
3240
|
setBottomBarCollapsed(false);
|
|
3212
3241
|
navigation.navigate("Feed");
|
|
3213
3242
|
}
|
|
3214
|
-
const actions = (0,
|
|
3243
|
+
const actions = (0, import_react15.useMemo)(() => ({
|
|
3215
3244
|
openDrawer: () => setDrawerOpen(true),
|
|
3216
3245
|
openComposer: () => setComposerOpen(true),
|
|
3217
3246
|
openNotifications: () => setNotifOpen(true),
|
|
@@ -3223,8 +3252,8 @@ function Shell({ children }) {
|
|
|
3223
3252
|
callAsk: () => _globalAskRef?.(),
|
|
3224
3253
|
setBottomBarCollapsed
|
|
3225
3254
|
}), []);
|
|
3226
|
-
return /* @__PURE__ */ (0,
|
|
3227
|
-
/* @__PURE__ */ (0,
|
|
3255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native22.View, { style: [styles15.root, { backgroundColor: tokens.bg }], children: [
|
|
3256
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3228
3257
|
Drawer,
|
|
3229
3258
|
{
|
|
3230
3259
|
activeRoute: feedScope,
|
|
@@ -3235,8 +3264,8 @@ function Shell({ children }) {
|
|
|
3235
3264
|
} : void 0
|
|
3236
3265
|
}
|
|
3237
3266
|
),
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3267
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native_reanimated3.default.View, { style: [styles15.pushed, drawerPushStyle, { backgroundColor: tokens.bg, paddingTop: insets.top + ANDROID_TOP_EXTRA4 }], children: [
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3240
3269
|
TopBar,
|
|
3241
3270
|
{
|
|
3242
3271
|
onOpenDrawer: () => setDrawerOpen(true),
|
|
@@ -3245,8 +3274,8 @@ function Shell({ children }) {
|
|
|
3245
3274
|
query: route.name === "Search" ? route.params?.query : void 0
|
|
3246
3275
|
}
|
|
3247
3276
|
),
|
|
3248
|
-
/* @__PURE__ */ (0,
|
|
3249
|
-
/* @__PURE__ */ (0,
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShellContext.Provider, { value: actions, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native22.View, { style: { flex: 1 }, children }) }),
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3250
3279
|
BottomBar,
|
|
3251
3280
|
{
|
|
3252
3281
|
collapsed: bottomBarCollapsed,
|
|
@@ -3262,10 +3291,10 @@ function Shell({ children }) {
|
|
|
3262
3291
|
onProfile: () => navigation.navigate("Profile")
|
|
3263
3292
|
}
|
|
3264
3293
|
),
|
|
3265
|
-
drawerOpen && /* @__PURE__ */ (0,
|
|
3266
|
-
!drawerOpen && route.name !== "Thread" && /* @__PURE__ */ (0,
|
|
3294
|
+
drawerOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native22.View, { style: import_react_native22.StyleSheet.absoluteFill, ...closeDrawerResponder.panHandlers }),
|
|
3295
|
+
!drawerOpen && route.name !== "Thread" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native22.View, { style: styles15.edgeZone, ...openDrawerResponder.panHandlers })
|
|
3267
3296
|
] }),
|
|
3268
|
-
composerOpen && /* @__PURE__ */ (0,
|
|
3297
|
+
composerOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3269
3298
|
ComposerOverlay,
|
|
3270
3299
|
{
|
|
3271
3300
|
onClose: closeComposer,
|
|
@@ -3278,7 +3307,7 @@ function Shell({ children }) {
|
|
|
3278
3307
|
},
|
|
3279
3308
|
loadedDraft?.id ?? "new"
|
|
3280
3309
|
),
|
|
3281
|
-
draftsOpen && /* @__PURE__ */ (0,
|
|
3310
|
+
draftsOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3282
3311
|
DraftsSheet,
|
|
3283
3312
|
{
|
|
3284
3313
|
apiUrl,
|
|
@@ -3291,10 +3320,10 @@ function Shell({ children }) {
|
|
|
3291
3320
|
}
|
|
3292
3321
|
}
|
|
3293
3322
|
),
|
|
3294
|
-
notifOpen && /* @__PURE__ */ (0,
|
|
3323
|
+
notifOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(NotificationsOverlay, { onClose: () => setNotifOpen(false) })
|
|
3295
3324
|
] });
|
|
3296
3325
|
}
|
|
3297
|
-
var
|
|
3326
|
+
var styles15 = import_react_native22.StyleSheet.create({
|
|
3298
3327
|
root: {
|
|
3299
3328
|
flex: 1
|
|
3300
3329
|
},
|
|
@@ -3311,13 +3340,13 @@ var styles14 = import_react_native21.StyleSheet.create({
|
|
|
3311
3340
|
});
|
|
3312
3341
|
|
|
3313
3342
|
// src/lib/useScrollCollapse.ts
|
|
3314
|
-
var
|
|
3343
|
+
var import_react16 = require("react");
|
|
3315
3344
|
var COLLAPSE_THRESHOLD = 14;
|
|
3316
3345
|
var EXPAND_THRESHOLD = 48;
|
|
3317
3346
|
var TOP_SNAP_Y = 24;
|
|
3318
3347
|
function useScrollCollapse() {
|
|
3319
3348
|
const { setBottomBarCollapsed } = useShell();
|
|
3320
|
-
const state = (0,
|
|
3349
|
+
const state = (0, import_react16.useRef)({ lastY: 0, downAccum: 0, upAccum: 0, collapsed: false });
|
|
3321
3350
|
return (e) => {
|
|
3322
3351
|
const y = Math.max(0, e.nativeEvent.contentOffset.y);
|
|
3323
3352
|
const s = state.current;
|
|
@@ -3353,17 +3382,17 @@ function useScrollCollapse() {
|
|
|
3353
3382
|
}
|
|
3354
3383
|
|
|
3355
3384
|
// src/feed/PostRow.tsx
|
|
3356
|
-
var
|
|
3357
|
-
var
|
|
3385
|
+
var import_react18 = require("react");
|
|
3386
|
+
var import_react_native27 = require("react-native");
|
|
3358
3387
|
|
|
3359
3388
|
// src/components/Thumbnail.tsx
|
|
3360
|
-
var
|
|
3361
|
-
var
|
|
3389
|
+
var import_react_native23 = require("react-native");
|
|
3390
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3362
3391
|
function Thumbnail({ imageUrl, radius, square, aspectRatio, style }) {
|
|
3363
3392
|
const { tokens } = useTheme();
|
|
3364
3393
|
const dims = square != null ? { width: square, height: square } : { width: "100%", aspectRatio: aspectRatio ?? 4 / 5 };
|
|
3365
|
-
return /* @__PURE__ */ (0,
|
|
3366
|
-
|
|
3394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3395
|
+
import_react_native23.Image,
|
|
3367
3396
|
{
|
|
3368
3397
|
source: { uri: imageUrl },
|
|
3369
3398
|
resizeMode: "cover",
|
|
@@ -3373,22 +3402,22 @@ function Thumbnail({ imageUrl, radius, square, aspectRatio, style }) {
|
|
|
3373
3402
|
}
|
|
3374
3403
|
|
|
3375
3404
|
// src/components/VotePill.tsx
|
|
3376
|
-
var
|
|
3377
|
-
var
|
|
3405
|
+
var import_react_native24 = require("react-native");
|
|
3406
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3378
3407
|
function VotePill({ voteCounts, dir, onVote }) {
|
|
3379
3408
|
const { tokens } = useTheme();
|
|
3380
|
-
return /* @__PURE__ */ (0,
|
|
3381
|
-
/* @__PURE__ */ (0,
|
|
3382
|
-
/* @__PURE__ */ (0,
|
|
3383
|
-
/* @__PURE__ */ (0,
|
|
3409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native24.View, { style: [styles16.pill, { backgroundColor: tokens["surface-2"] }], children: [
|
|
3410
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native24.Pressable, { onPress: () => onVote(1), hitSlop: 8, style: styles16.unit, children: [
|
|
3411
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UpvoteIcon, { size: 17, color: dir === 1 ? tokens.up : tokens.muted, filled: dir === 1 }),
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native24.Text, { style: [styles16.count, { color: dir === 1 ? tokens.up : tokens["text-2"] }], children: voteCounts.up })
|
|
3384
3413
|
] }),
|
|
3385
|
-
/* @__PURE__ */ (0,
|
|
3386
|
-
/* @__PURE__ */ (0,
|
|
3387
|
-
/* @__PURE__ */ (0,
|
|
3414
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native24.Pressable, { onPress: () => onVote(-1), hitSlop: 8, style: styles16.unit, children: [
|
|
3415
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DownvoteIcon, { size: 17, color: dir === -1 ? tokens.down : tokens.muted, filled: dir === -1 }),
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native24.Text, { style: [styles16.count, { color: dir === -1 ? tokens.down : tokens["text-2"] }], children: voteCounts.down })
|
|
3388
3417
|
] })
|
|
3389
3418
|
] });
|
|
3390
3419
|
}
|
|
3391
|
-
var
|
|
3420
|
+
var styles16 = import_react_native24.StyleSheet.create({
|
|
3392
3421
|
pill: {
|
|
3393
3422
|
flexDirection: "row",
|
|
3394
3423
|
alignItems: "center",
|
|
@@ -3402,16 +3431,16 @@ var styles15 = import_react_native23.StyleSheet.create({
|
|
|
3402
3431
|
});
|
|
3403
3432
|
|
|
3404
3433
|
// src/components/CommentPill.tsx
|
|
3405
|
-
var
|
|
3406
|
-
var
|
|
3434
|
+
var import_react_native25 = require("react-native");
|
|
3435
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3407
3436
|
function CommentPill({ count }) {
|
|
3408
3437
|
const { tokens } = useTheme();
|
|
3409
|
-
return /* @__PURE__ */ (0,
|
|
3410
|
-
/* @__PURE__ */ (0,
|
|
3411
|
-
/* @__PURE__ */ (0,
|
|
3438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native25.View, { style: [styles17.pill, { backgroundColor: tokens["surface-2"] }], children: [
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CommentIcon, { size: 17, color: tokens["text-2"] }),
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native25.Text, { style: [styles17.count, { color: tokens["text-2"] }], children: count })
|
|
3412
3441
|
] });
|
|
3413
3442
|
}
|
|
3414
|
-
var
|
|
3443
|
+
var styles17 = import_react_native25.StyleSheet.create({
|
|
3415
3444
|
pill: {
|
|
3416
3445
|
flexDirection: "row",
|
|
3417
3446
|
alignItems: "center",
|
|
@@ -3427,13 +3456,13 @@ var styles16 = import_react_native24.StyleSheet.create({
|
|
|
3427
3456
|
});
|
|
3428
3457
|
|
|
3429
3458
|
// src/components/DropdownMenu.tsx
|
|
3430
|
-
var
|
|
3431
|
-
var
|
|
3432
|
-
var
|
|
3459
|
+
var import_react17 = require("react");
|
|
3460
|
+
var import_react_native26 = require("react-native");
|
|
3461
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3433
3462
|
function useAnchor() {
|
|
3434
|
-
const ref = (0,
|
|
3435
|
-
const [anchor, setAnchor] = (0,
|
|
3436
|
-
const measure = (0,
|
|
3463
|
+
const ref = (0, import_react17.useRef)(null);
|
|
3464
|
+
const [anchor, setAnchor] = (0, import_react17.useState)(null);
|
|
3465
|
+
const measure = (0, import_react17.useCallback)((cb) => {
|
|
3437
3466
|
ref.current?.measureInWindow((x, y, width, height) => {
|
|
3438
3467
|
setAnchor({ x, y, width, height });
|
|
3439
3468
|
cb?.();
|
|
@@ -3446,13 +3475,13 @@ function DropdownMenu({ visible, onClose, anchor, width = 150, align = "left", c
|
|
|
3446
3475
|
if (!anchor) return null;
|
|
3447
3476
|
const top = anchor.y + anchor.height + 4;
|
|
3448
3477
|
const left = align === "left" ? anchor.x : anchor.x + anchor.width - width;
|
|
3449
|
-
return /* @__PURE__ */ (0,
|
|
3450
|
-
|
|
3478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native26.Modal, { visible, transparent: true, animationType: "none", statusBarTranslucent: true, onRequestClose: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native26.Pressable, { style: import_react_native26.StyleSheet.absoluteFill, onPress: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3479
|
+
import_react_native26.Pressable,
|
|
3451
3480
|
{
|
|
3452
3481
|
onPress: () => {
|
|
3453
3482
|
},
|
|
3454
3483
|
style: [
|
|
3455
|
-
|
|
3484
|
+
styles18.card,
|
|
3456
3485
|
{ top, left, width, backgroundColor: tokens.elev, borderColor: tokens.border }
|
|
3457
3486
|
],
|
|
3458
3487
|
children
|
|
@@ -3461,12 +3490,12 @@ function DropdownMenu({ visible, onClose, anchor, width = 150, align = "left", c
|
|
|
3461
3490
|
}
|
|
3462
3491
|
function DropdownMenuItem({ label, active, icon, labelColor, onPress }) {
|
|
3463
3492
|
const { tokens } = useTheme();
|
|
3464
|
-
return /* @__PURE__ */ (0,
|
|
3493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_native26.Pressable, { onPress, style: [styles18.item, active ? { backgroundColor: tokens["hover-2"] } : null], children: [
|
|
3465
3494
|
icon,
|
|
3466
|
-
/* @__PURE__ */ (0,
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native26.Text, { style: { color: labelColor ?? tokens.text, fontSize: 13.5, fontWeight: active ? "600" : "400" }, children: label })
|
|
3467
3496
|
] });
|
|
3468
3497
|
}
|
|
3469
|
-
var
|
|
3498
|
+
var styles18 = import_react_native26.StyleSheet.create({
|
|
3470
3499
|
card: {
|
|
3471
3500
|
position: "absolute",
|
|
3472
3501
|
borderWidth: 1,
|
|
@@ -3489,82 +3518,82 @@ var styles17 = import_react_native25.StyleSheet.create({
|
|
|
3489
3518
|
});
|
|
3490
3519
|
|
|
3491
3520
|
// src/feed/PostRow.tsx
|
|
3492
|
-
var
|
|
3521
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3493
3522
|
function PostRow({ row, view, onOpen, onVote, onSave, onReport, onShare, onPressAuthor }) {
|
|
3494
3523
|
const { tokens } = useTheme();
|
|
3495
3524
|
const { ref: ellipsisRef, anchor, measure } = useAnchor();
|
|
3496
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
3525
|
+
const [menuOpen, setMenuOpen] = (0, import_react18.useState)(false);
|
|
3497
3526
|
const imageUrl = row.imageUrl;
|
|
3498
3527
|
const videoUrl = row.videoUrl;
|
|
3499
3528
|
const extraMediaCount = Math.max(0, row.mediaCount - 1);
|
|
3500
|
-
return /* @__PURE__ */ (0,
|
|
3501
|
-
/* @__PURE__ */ (0,
|
|
3502
|
-
|
|
3529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.Pressable, { onPress: onOpen, style: [styles19.row, { borderBottomColor: tokens.border }], children: [
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3531
|
+
import_react_native27.Pressable,
|
|
3503
3532
|
{
|
|
3504
|
-
style:
|
|
3533
|
+
style: styles19.head,
|
|
3505
3534
|
onPress: onPressAuthor ? () => onPressAuthor(row.authorId) : void 0,
|
|
3506
3535
|
disabled: !onPressAuthor,
|
|
3507
3536
|
children: [
|
|
3508
|
-
/* @__PURE__ */ (0,
|
|
3509
|
-
/* @__PURE__ */ (0,
|
|
3510
|
-
/* @__PURE__ */ (0,
|
|
3537
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Avatar, { authorId: row.authorId, author: row.author, avatarUrl: row.authorAvatarUrl, size: 22 }),
|
|
3538
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.Text, { style: [styles19.author, { color: tokens.text }], children: row.author }),
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.Text, { style: [styles19.time, { color: tokens.muted }], children: [
|
|
3511
3540
|
"\xB7 ",
|
|
3512
3541
|
row.time
|
|
3513
3542
|
] })
|
|
3514
3543
|
]
|
|
3515
3544
|
}
|
|
3516
3545
|
),
|
|
3517
|
-
view === "card" ? /* @__PURE__ */ (0,
|
|
3518
|
-
/* @__PURE__ */ (0,
|
|
3519
|
-
imageUrl != null ? /* @__PURE__ */ (0,
|
|
3520
|
-
/* @__PURE__ */ (0,
|
|
3521
|
-
extraMediaCount > 0 && /* @__PURE__ */ (0,
|
|
3546
|
+
view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.Text, { style: [styles19.title, { color: tokens.text }], numberOfLines: 3, children: row.title }),
|
|
3548
|
+
imageUrl != null ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.View, { style: { marginBottom: 10 }, children: [
|
|
3549
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Thumbnail, { imageUrl, aspectRatio: 4 / 5, radius: 14 }),
|
|
3550
|
+
extraMediaCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.View, { style: [styles19.moreBadge, { backgroundColor: "rgba(0,0,0,0.65)" }], children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.Text, { style: styles19.moreBadgeText, children: [
|
|
3522
3551
|
"+",
|
|
3523
3552
|
extraMediaCount
|
|
3524
3553
|
] }) })
|
|
3525
|
-
] }) : videoUrl != null ? /* @__PURE__ */ (0,
|
|
3526
|
-
/* @__PURE__ */ (0,
|
|
3527
|
-
extraMediaCount > 0 && /* @__PURE__ */ (0,
|
|
3554
|
+
] }) : videoUrl != null ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.View, { style: { marginBottom: 10 }, children: [
|
|
3555
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(InlineVideoThumb, { uri: videoUrl, style: [styles19.cardVideo, { backgroundColor: tokens["surface-2"] }] }),
|
|
3556
|
+
extraMediaCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.View, { style: [styles19.moreBadge, { backgroundColor: "rgba(0,0,0,0.65)" }], children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.Text, { style: styles19.moreBadgeText, children: [
|
|
3528
3557
|
"+",
|
|
3529
3558
|
extraMediaCount
|
|
3530
3559
|
] }) })
|
|
3531
3560
|
] }) : null
|
|
3532
|
-
] }) : /* @__PURE__ */ (0,
|
|
3533
|
-
/* @__PURE__ */ (0,
|
|
3534
|
-
imageUrl != null ? /* @__PURE__ */ (0,
|
|
3535
|
-
/* @__PURE__ */ (0,
|
|
3536
|
-
extraMediaCount > 0 && /* @__PURE__ */ (0,
|
|
3561
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.View, { style: styles19.compactBody, children: [
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.Text, { style: [styles19.title, styles19.titleCompact, { color: tokens.text }], numberOfLines: 3, children: row.title }),
|
|
3563
|
+
imageUrl != null ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.View, { children: [
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Thumbnail, { imageUrl, square: 78, radius: 12 }),
|
|
3565
|
+
extraMediaCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.View, { style: [styles19.moreBadge, styles19.moreBadgeCompact, { backgroundColor: "rgba(0,0,0,0.65)" }], children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.Text, { style: styles19.moreBadgeText, children: [
|
|
3537
3566
|
"+",
|
|
3538
3567
|
extraMediaCount
|
|
3539
3568
|
] }) })
|
|
3540
|
-
] }) : videoUrl != null ? /* @__PURE__ */ (0,
|
|
3541
|
-
/* @__PURE__ */ (0,
|
|
3542
|
-
extraMediaCount > 0 && /* @__PURE__ */ (0,
|
|
3569
|
+
] }) : videoUrl != null ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.View, { children: [
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(InlineVideoThumb, { uri: videoUrl, style: [styles19.compactVideo, { backgroundColor: tokens["surface-2"] }] }),
|
|
3571
|
+
extraMediaCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.View, { style: [styles19.moreBadge, styles19.moreBadgeCompact, { backgroundColor: "rgba(0,0,0,0.65)" }], children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.Text, { style: styles19.moreBadgeText, children: [
|
|
3543
3572
|
"+",
|
|
3544
3573
|
extraMediaCount
|
|
3545
3574
|
] }) })
|
|
3546
3575
|
] }) : null
|
|
3547
3576
|
] }),
|
|
3548
|
-
/* @__PURE__ */ (0,
|
|
3549
|
-
/* @__PURE__ */ (0,
|
|
3550
|
-
/* @__PURE__ */ (0,
|
|
3551
|
-
/* @__PURE__ */ (0,
|
|
3552
|
-
/* @__PURE__ */ (0,
|
|
3553
|
-
/* @__PURE__ */ (0,
|
|
3554
|
-
|
|
3577
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_native27.View, { style: styles19.actions, children: [
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VotePill, { voteCounts: row.voteCounts, dir: row.myVote, onVote }),
|
|
3579
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CommentPill, { count: row.commentCount }),
|
|
3580
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.View, { style: { flex: 1 } }),
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native27.Pressable, { onPress: onShare, style: [styles19.circle, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ShareIcon, { size: 17, color: tokens["text-2"] }) }),
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3583
|
+
import_react_native27.Pressable,
|
|
3555
3584
|
{
|
|
3556
3585
|
ref: ellipsisRef,
|
|
3557
3586
|
onPress: () => measure(() => setMenuOpen(true)),
|
|
3558
|
-
style: [
|
|
3559
|
-
children: /* @__PURE__ */ (0,
|
|
3587
|
+
style: [styles19.circle, { backgroundColor: menuOpen ? tokens["hover-2"] : tokens["surface-2"] }],
|
|
3588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(EllipsisIcon, { size: 17, color: tokens["text-2"] })
|
|
3560
3589
|
}
|
|
3561
3590
|
)
|
|
3562
3591
|
] }),
|
|
3563
|
-
/* @__PURE__ */ (0,
|
|
3564
|
-
/* @__PURE__ */ (0,
|
|
3592
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenu, { visible: menuOpen, onClose: () => setMenuOpen(false), anchor, width: 150, align: "right", children: [
|
|
3593
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3565
3594
|
DropdownMenuItem,
|
|
3566
3595
|
{
|
|
3567
|
-
icon: /* @__PURE__ */ (0,
|
|
3596
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SaveIcon, { size: 16, color: tokens["text-2"], filled: row.saved }),
|
|
3568
3597
|
label: row.saved ? "Unsave" : "Save",
|
|
3569
3598
|
onPress: () => {
|
|
3570
3599
|
setMenuOpen(false);
|
|
@@ -3572,10 +3601,10 @@ function PostRow({ row, view, onOpen, onVote, onSave, onReport, onShare, onPress
|
|
|
3572
3601
|
}
|
|
3573
3602
|
}
|
|
3574
3603
|
),
|
|
3575
|
-
/* @__PURE__ */ (0,
|
|
3604
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3576
3605
|
DropdownMenuItem,
|
|
3577
3606
|
{
|
|
3578
|
-
icon: /* @__PURE__ */ (0,
|
|
3607
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ReportIcon, { size: 16, color: tokens["text-2"] }),
|
|
3579
3608
|
label: "Report",
|
|
3580
3609
|
onPress: () => {
|
|
3581
3610
|
setMenuOpen(false);
|
|
@@ -3586,12 +3615,12 @@ function PostRow({ row, view, onOpen, onVote, onSave, onReport, onShare, onPress
|
|
|
3586
3615
|
] })
|
|
3587
3616
|
] });
|
|
3588
3617
|
}
|
|
3589
|
-
var
|
|
3618
|
+
var styles19 = import_react_native27.StyleSheet.create({
|
|
3590
3619
|
row: {
|
|
3591
3620
|
paddingHorizontal: 14,
|
|
3592
3621
|
paddingTop: 12,
|
|
3593
3622
|
paddingBottom: 12,
|
|
3594
|
-
borderBottomWidth:
|
|
3623
|
+
borderBottomWidth: import_react_native27.StyleSheet.hairlineWidth
|
|
3595
3624
|
},
|
|
3596
3625
|
head: {
|
|
3597
3626
|
flexDirection: "row",
|
|
@@ -3652,9 +3681,9 @@ var styles18 = import_react_native26.StyleSheet.create({
|
|
|
3652
3681
|
});
|
|
3653
3682
|
|
|
3654
3683
|
// src/components/SelectPill.tsx
|
|
3655
|
-
var
|
|
3656
|
-
var
|
|
3657
|
-
var
|
|
3684
|
+
var import_react19 = require("react");
|
|
3685
|
+
var import_react_native28 = require("react-native");
|
|
3686
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3658
3687
|
function SelectPill({
|
|
3659
3688
|
value,
|
|
3660
3689
|
options,
|
|
@@ -3667,22 +3696,22 @@ function SelectPill({
|
|
|
3667
3696
|
}) {
|
|
3668
3697
|
const { tokens } = useTheme();
|
|
3669
3698
|
const { ref, anchor, measure } = useAnchor();
|
|
3670
|
-
const [open, setOpen] = (0,
|
|
3671
|
-
return /* @__PURE__ */ (0,
|
|
3672
|
-
/* @__PURE__ */ (0,
|
|
3673
|
-
|
|
3699
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
3700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
3701
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3702
|
+
import_react_native28.Pressable,
|
|
3674
3703
|
{
|
|
3675
3704
|
ref,
|
|
3676
3705
|
onPress: () => measure(() => setOpen(true)),
|
|
3677
|
-
style: [
|
|
3706
|
+
style: [styles20.pill, { backgroundColor: tokens["surface-2"] }],
|
|
3678
3707
|
children: [
|
|
3679
3708
|
leadingIcon,
|
|
3680
|
-
label != null && /* @__PURE__ */ (0,
|
|
3681
|
-
/* @__PURE__ */ (0,
|
|
3709
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_native28.Text, { style: [styles20.label, { color: tokens.text }], children: label }),
|
|
3710
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDownIcon, { size: 14, color: tokens["text-2"] })
|
|
3682
3711
|
]
|
|
3683
3712
|
}
|
|
3684
3713
|
),
|
|
3685
|
-
/* @__PURE__ */ (0,
|
|
3714
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropdownMenu, { visible: open, onClose: () => setOpen(false), anchor, width: menuWidth, children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3686
3715
|
DropdownMenuItem,
|
|
3687
3716
|
{
|
|
3688
3717
|
icon: optionIcon?.(opt),
|
|
@@ -3697,7 +3726,7 @@ function SelectPill({
|
|
|
3697
3726
|
)) })
|
|
3698
3727
|
] });
|
|
3699
3728
|
}
|
|
3700
|
-
var
|
|
3729
|
+
var styles20 = import_react_native28.StyleSheet.create({
|
|
3701
3730
|
pill: {
|
|
3702
3731
|
flexDirection: "row",
|
|
3703
3732
|
alignItems: "center",
|
|
@@ -3713,35 +3742,33 @@ var styles19 = import_react_native27.StyleSheet.create({
|
|
|
3713
3742
|
});
|
|
3714
3743
|
|
|
3715
3744
|
// src/components/ReportSheet.tsx
|
|
3716
|
-
var
|
|
3717
|
-
var
|
|
3745
|
+
var import_react_native29 = require("react-native");
|
|
3746
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3718
3747
|
var REASONS = ["Spam", "Harassment or bullying", "Hate speech", "Misinformation", "Sexual content", "Other"];
|
|
3719
3748
|
function ReportSheet({ target, onClose, onSubmit }) {
|
|
3720
3749
|
const { tokens } = useTheme();
|
|
3721
3750
|
const { maxHeight, paddingBottom } = useSheetLayout(28);
|
|
3722
|
-
return /* @__PURE__ */ (0,
|
|
3723
|
-
|
|
3724
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react_native28.Text, { style: [styles20.title, { color: tokens.text }], children: [
|
|
3751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(BottomSheetShell, { visible: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react_native29.View, { style: [styles21.sheet, { backgroundColor: tokens.elev, borderColor: tokens.border, maxHeight, paddingBottom }], children: [
|
|
3752
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react_native29.Text, { style: [styles21.title, { color: tokens.text }], children: [
|
|
3725
3753
|
"Report ",
|
|
3726
3754
|
target
|
|
3727
3755
|
] }),
|
|
3728
|
-
REASONS.map((reason) => /* @__PURE__ */ (0,
|
|
3729
|
-
|
|
3756
|
+
REASONS.map((reason) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3757
|
+
import_react_native29.Pressable,
|
|
3730
3758
|
{
|
|
3731
3759
|
onPress: () => {
|
|
3732
3760
|
onSubmit(reason);
|
|
3733
3761
|
onClose();
|
|
3734
3762
|
},
|
|
3735
|
-
style: [
|
|
3736
|
-
children: /* @__PURE__ */ (0,
|
|
3763
|
+
style: [styles21.row, { borderTopColor: tokens.border }],
|
|
3764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native29.Text, { style: { color: tokens.text, fontSize: 14.5 }, children: reason })
|
|
3737
3765
|
},
|
|
3738
3766
|
reason
|
|
3739
3767
|
)),
|
|
3740
|
-
/* @__PURE__ */ (0,
|
|
3741
|
-
] }) })
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native29.Pressable, { onPress: onClose, style: [styles21.cancel, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native29.Text, { style: { color: tokens["text-2"], fontWeight: "700", fontSize: 14 }, children: "Cancel" }) })
|
|
3769
|
+
] }) });
|
|
3742
3770
|
}
|
|
3743
|
-
var
|
|
3744
|
-
scrim: { flex: 1, backgroundColor: "rgba(0,0,0,0.5)", justifyContent: "flex-end" },
|
|
3771
|
+
var styles21 = import_react_native29.StyleSheet.create({
|
|
3745
3772
|
sheet: { borderTopWidth: 1, borderTopLeftRadius: 18, borderTopRightRadius: 18, paddingHorizontal: 16, paddingTop: 16 },
|
|
3746
3773
|
title: { fontSize: 16, fontWeight: "800", marginBottom: 8 },
|
|
3747
3774
|
row: { paddingVertical: 14, borderTopWidth: 1 },
|
|
@@ -3749,17 +3776,17 @@ var styles20 = import_react_native28.StyleSheet.create({
|
|
|
3749
3776
|
});
|
|
3750
3777
|
|
|
3751
3778
|
// src/components/ShareSheet.tsx
|
|
3752
|
-
var
|
|
3753
|
-
var
|
|
3754
|
-
var
|
|
3779
|
+
var import_react20 = require("react");
|
|
3780
|
+
var import_react_native30 = require("react-native");
|
|
3781
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3755
3782
|
function ShareSheet({ apiUrl, forumId, token, onClose, onShare }) {
|
|
3756
3783
|
const { tokens } = useTheme();
|
|
3757
3784
|
const { maxHeight, paddingBottom } = useSheetLayout(28);
|
|
3758
|
-
const [query, setQuery] = (0,
|
|
3759
|
-
const [results, setResults] = (0,
|
|
3760
|
-
const [loading, setLoading] = (0,
|
|
3761
|
-
const [selected, setSelected] = (0,
|
|
3762
|
-
(0,
|
|
3785
|
+
const [query, setQuery] = (0, import_react20.useState)("");
|
|
3786
|
+
const [results, setResults] = (0, import_react20.useState)([]);
|
|
3787
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
3788
|
+
const [selected, setSelected] = (0, import_react20.useState)(/* @__PURE__ */ new Set());
|
|
3789
|
+
(0, import_react20.useEffect)(() => {
|
|
3763
3790
|
if (!token) return;
|
|
3764
3791
|
const q = query.trim();
|
|
3765
3792
|
if (!q) {
|
|
@@ -3780,138 +3807,128 @@ function ShareSheet({ apiUrl, forumId, token, onClose, onShare }) {
|
|
|
3780
3807
|
return next;
|
|
3781
3808
|
});
|
|
3782
3809
|
}
|
|
3783
|
-
return /* @__PURE__ */ (0,
|
|
3784
|
-
/* @__PURE__ */ (0,
|
|
3785
|
-
/* @__PURE__ */ (0,
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
)
|
|
3830
|
-
] }) })
|
|
3831
|
-
] }) });
|
|
3810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BottomSheetShell, { visible: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native30.KeyboardAvoidingView, { style: { flex: 1, justifyContent: "flex-end" }, behavior: import_react_native30.Platform.OS === "ios" ? "padding" : "height", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_native30.View, { style: [styles22.sheet, { backgroundColor: tokens.elev, borderColor: tokens.border, maxHeight, paddingBottom }], children: [
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native30.Text, { style: [styles22.title, { color: tokens.text }], children: "Share with a member" }),
|
|
3812
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3813
|
+
import_react_native30.TextInput,
|
|
3814
|
+
{
|
|
3815
|
+
value: query,
|
|
3816
|
+
onChangeText: setQuery,
|
|
3817
|
+
placeholder: "Search members",
|
|
3818
|
+
placeholderTextColor: tokens.muted,
|
|
3819
|
+
style: [styles22.search, { color: tokens.text, backgroundColor: tokens["surface-2"] }]
|
|
3820
|
+
}
|
|
3821
|
+
),
|
|
3822
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native30.ActivityIndicator, { color: tokens.accent, style: { padding: 16 } }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3823
|
+
import_react_native30.FlatList,
|
|
3824
|
+
{
|
|
3825
|
+
data: results,
|
|
3826
|
+
keyExtractor: (u) => u.id,
|
|
3827
|
+
style: { maxHeight: 260 },
|
|
3828
|
+
keyboardShouldPersistTaps: "handled",
|
|
3829
|
+
renderItem: ({ item }) => {
|
|
3830
|
+
const isSel = selected.has(item.id);
|
|
3831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_native30.Pressable, { onPress: () => toggle(item.id), style: styles22.row, children: [
|
|
3832
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Avatar, { authorId: item.id, author: item.displayName, avatarUrl: item.avatarUrl, size: 32 }),
|
|
3833
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native30.Text, { style: { flex: 1, color: tokens.text, fontSize: 14 }, children: item.displayName }),
|
|
3834
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native30.View, { style: [styles22.check, { borderColor: isSel ? tokens.accent : tokens["border-strong"], backgroundColor: isSel ? tokens.accent : "transparent" }] })
|
|
3835
|
+
] });
|
|
3836
|
+
},
|
|
3837
|
+
ListEmptyComponent: query.trim() ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native30.Text, { style: { color: tokens.muted, fontSize: 13, padding: 12 }, children: "No members found" }) : null
|
|
3838
|
+
}
|
|
3839
|
+
),
|
|
3840
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3841
|
+
import_react_native30.Pressable,
|
|
3842
|
+
{
|
|
3843
|
+
onPress: () => {
|
|
3844
|
+
onShare([...selected]);
|
|
3845
|
+
onClose();
|
|
3846
|
+
},
|
|
3847
|
+
disabled: selected.size === 0,
|
|
3848
|
+
style: [styles22.shareBtn, { backgroundColor: tokens.accent, opacity: selected.size ? 1 : 0.5 }],
|
|
3849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_native30.Text, { style: { color: tokens["accent-fg"], fontWeight: "700", fontSize: 14 }, children: [
|
|
3850
|
+
"Share",
|
|
3851
|
+
selected.size ? ` (${selected.size})` : ""
|
|
3852
|
+
] })
|
|
3853
|
+
}
|
|
3854
|
+
)
|
|
3855
|
+
] }) }) });
|
|
3832
3856
|
}
|
|
3833
|
-
var
|
|
3834
|
-
scrim: { ...import_react_native29.StyleSheet.absoluteFill, backgroundColor: "rgba(0,0,0,0.5)" },
|
|
3835
|
-
sheetWrap: { flex: 1, justifyContent: "flex-end" },
|
|
3857
|
+
var styles22 = import_react_native30.StyleSheet.create({
|
|
3836
3858
|
sheet: { borderTopWidth: 1, borderTopLeftRadius: 18, borderTopRightRadius: 18, paddingHorizontal: 16, paddingTop: 16 },
|
|
3837
3859
|
title: { fontSize: 16, fontWeight: "800", marginBottom: 12 },
|
|
3838
|
-
search: {
|
|
3860
|
+
search: { borderRadius: 999, paddingHorizontal: 14, paddingVertical: 9, fontSize: 14 },
|
|
3839
3861
|
row: { flexDirection: "row", alignItems: "center", gap: 10, paddingVertical: 10 },
|
|
3840
3862
|
check: { width: 20, height: 20, borderRadius: 10, borderWidth: 2 },
|
|
3841
3863
|
shareBtn: { borderRadius: 999, paddingVertical: 12, alignItems: "center", marginTop: 12 }
|
|
3842
3864
|
});
|
|
3843
3865
|
|
|
3844
3866
|
// src/profile/UserProfileSheet.tsx
|
|
3845
|
-
var
|
|
3846
|
-
var
|
|
3867
|
+
var import_react23 = require("react");
|
|
3868
|
+
var import_react_native36 = require("react-native");
|
|
3847
3869
|
var import_react_native_safe_area_context8 = require("react-native-safe-area-context");
|
|
3848
3870
|
|
|
3849
3871
|
// src/components/TabPills.tsx
|
|
3850
|
-
var
|
|
3851
|
-
var
|
|
3872
|
+
var import_react_native31 = require("react-native");
|
|
3873
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3852
3874
|
function TabPills({ tabs, active, onSelect }) {
|
|
3853
3875
|
const { tokens } = useTheme();
|
|
3854
|
-
return /* @__PURE__ */ (0,
|
|
3855
|
-
|
|
3876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native31.View, { style: [styles23.container, { borderBottomColor: tokens.border }], children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3877
|
+
import_react_native31.ScrollView,
|
|
3856
3878
|
{
|
|
3857
3879
|
horizontal: true,
|
|
3858
3880
|
showsHorizontalScrollIndicator: false,
|
|
3859
|
-
contentContainerStyle:
|
|
3881
|
+
contentContainerStyle: styles23.row,
|
|
3860
3882
|
children: tabs.map((tab) => {
|
|
3861
3883
|
const isActive = tab === active;
|
|
3862
|
-
return /* @__PURE__ */ (0,
|
|
3863
|
-
/* @__PURE__ */ (0,
|
|
3864
|
-
/* @__PURE__ */ (0,
|
|
3884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native31.Pressable, { onPress: () => onSelect(tab), style: styles23.tab, children: [
|
|
3885
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native31.Text, { style: { color: isActive ? tokens.text : tokens.muted, fontSize: 15, fontWeight: isActive ? "700" : "500" }, children: tab }),
|
|
3886
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native31.View, { style: [styles23.underline, { backgroundColor: isActive ? tokens.accent : "transparent" }] })
|
|
3865
3887
|
] }, tab);
|
|
3866
3888
|
})
|
|
3867
3889
|
}
|
|
3868
3890
|
) });
|
|
3869
3891
|
}
|
|
3870
|
-
var
|
|
3892
|
+
var styles23 = import_react_native31.StyleSheet.create({
|
|
3871
3893
|
// The hairline border is the full-width rail; the active tab's underline
|
|
3872
3894
|
// sits flush at bottom: 0 on top of it.
|
|
3873
|
-
container: { borderBottomWidth:
|
|
3895
|
+
container: { borderBottomWidth: import_react_native31.StyleSheet.hairlineWidth },
|
|
3874
3896
|
row: { gap: 35, paddingHorizontal: 16 },
|
|
3875
3897
|
tab: { alignItems: "center", paddingTop: 8, paddingBottom: 0 },
|
|
3876
3898
|
underline: { height: 3, borderRadius: 2, alignSelf: "stretch", marginTop: 6 }
|
|
3877
3899
|
});
|
|
3878
3900
|
|
|
3879
3901
|
// src/profile/SocialLinks.tsx
|
|
3880
|
-
var
|
|
3881
|
-
var
|
|
3902
|
+
var import_react21 = require("react");
|
|
3903
|
+
var import_react_native33 = require("react-native");
|
|
3882
3904
|
|
|
3883
3905
|
// src/profile/AllSocialLinksSheet.tsx
|
|
3884
|
-
var
|
|
3885
|
-
var
|
|
3906
|
+
var import_react_native32 = require("react-native");
|
|
3907
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3886
3908
|
function AllSocialLinksSheet({ links, onClose, onEditProfile }) {
|
|
3887
3909
|
const { tokens } = useTheme();
|
|
3888
3910
|
const { maxHeight, paddingBottom } = useSheetLayout(24);
|
|
3889
|
-
return /* @__PURE__ */ (0,
|
|
3890
|
-
/* @__PURE__ */ (0,
|
|
3891
|
-
|
|
3892
|
-
/* @__PURE__ */ (0,
|
|
3893
|
-
/* @__PURE__ */ (0,
|
|
3894
|
-
/* @__PURE__ */ (0,
|
|
3895
|
-
|
|
3896
|
-
|
|
3911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BottomSheetShell, { visible: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native32.View, { style: [styles24.sheet, { backgroundColor: tokens.elev, borderColor: tokens.border, maxHeight, paddingBottom }], children: [
|
|
3912
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native32.View, { style: styles24.header, children: [
|
|
3913
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native32.Text, { style: [styles24.title, { color: tokens.text }], children: "Social links" }),
|
|
3914
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native32.View, { style: styles24.headerBtns, children: [
|
|
3915
|
+
onEditProfile && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native32.Pressable, { onPress: onEditProfile, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PencilIcon, { size: 16, color: tokens.text }) }),
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native32.Pressable, { onPress: onClose, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CloseIcon, { size: 18, color: tokens.text }) })
|
|
3917
|
+
] })
|
|
3918
|
+
] }),
|
|
3919
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native32.ScrollView, { contentContainerStyle: { paddingBottom: 8 }, children: links.map((l, i) => {
|
|
3920
|
+
const Icon = SOCIAL_PLATFORM_ICON[l.platform] ?? LinkIcon;
|
|
3921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native32.Pressable, { onPress: () => void import_react_native32.Linking.openURL(l.url), style: styles24.row, children: [
|
|
3922
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { size: 18, color: tokens.text }),
|
|
3923
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native32.View, { style: { flex: 1 }, children: [
|
|
3924
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native32.Text, { style: [styles24.platform, { color: tokens.text }], children: l.platform }),
|
|
3925
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native32.Text, { style: [styles24.url, { color: tokens.muted }], numberOfLines: 1, children: l.url })
|
|
3897
3926
|
] })
|
|
3898
|
-
] })
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native31.Pressable, { onPress: () => void import_react_native31.Linking.openURL(l.url), style: styles23.row, children: [
|
|
3902
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { size: 18, color: tokens.text }),
|
|
3903
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native31.View, { style: { flex: 1 }, children: [
|
|
3904
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native31.Text, { style: [styles23.platform, { color: tokens.text }], children: l.platform }),
|
|
3905
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native31.Text, { style: [styles23.url, { color: tokens.muted }], numberOfLines: 1, children: l.url })
|
|
3906
|
-
] })
|
|
3907
|
-
] }, `${l.platform}-${i}`);
|
|
3908
|
-
}) })
|
|
3909
|
-
] }) })
|
|
3910
|
-
] });
|
|
3927
|
+
] }, `${l.platform}-${i}`);
|
|
3928
|
+
}) })
|
|
3929
|
+
] }) });
|
|
3911
3930
|
}
|
|
3912
|
-
var
|
|
3913
|
-
scrim: { ...import_react_native31.StyleSheet.absoluteFill, backgroundColor: "rgba(0,0,0,0.5)" },
|
|
3914
|
-
sheetWrap: { flex: 1, justifyContent: "flex-end" },
|
|
3931
|
+
var styles24 = import_react_native32.StyleSheet.create({
|
|
3915
3932
|
sheet: { borderTopWidth: 1, borderTopLeftRadius: 18, borderTopRightRadius: 18, paddingHorizontal: 16, paddingTop: 16, overflow: "hidden" },
|
|
3916
3933
|
header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: 8 },
|
|
3917
3934
|
headerBtns: { flexDirection: "row", alignItems: "center", gap: 18 },
|
|
@@ -3923,7 +3940,7 @@ var styles23 = import_react_native31.StyleSheet.create({
|
|
|
3923
3940
|
});
|
|
3924
3941
|
|
|
3925
3942
|
// src/profile/SocialLinks.tsx
|
|
3926
|
-
var
|
|
3943
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3927
3944
|
var SOCIAL_PLATFORM_ICON = {
|
|
3928
3945
|
Website: GlobeIcon,
|
|
3929
3946
|
Portfolio: GlobeIcon,
|
|
@@ -3937,35 +3954,35 @@ var SOCIAL_PLATFORM_ICON = {
|
|
|
3937
3954
|
var MAX_INLINE = 3;
|
|
3938
3955
|
function SocialLinks({ links, onEditProfile }) {
|
|
3939
3956
|
const { tokens } = useTheme();
|
|
3940
|
-
const [viewAllOpen, setViewAllOpen] = (0,
|
|
3941
|
-
const [maxInline, setMaxInline] = (0,
|
|
3942
|
-
const firstPillY = (0,
|
|
3943
|
-
const shrunk = (0,
|
|
3957
|
+
const [viewAllOpen, setViewAllOpen] = (0, import_react21.useState)(false);
|
|
3958
|
+
const [maxInline, setMaxInline] = (0, import_react21.useState)(MAX_INLINE);
|
|
3959
|
+
const firstPillY = (0, import_react21.useRef)(null);
|
|
3960
|
+
const shrunk = (0, import_react21.useRef)(false);
|
|
3944
3961
|
if (links.length === 0) return null;
|
|
3945
3962
|
const inline = links.slice(0, maxInline);
|
|
3946
3963
|
const hasMore = links.length > maxInline;
|
|
3947
|
-
return /* @__PURE__ */ (0,
|
|
3948
|
-
/* @__PURE__ */ (0,
|
|
3964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3965
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_native33.View, { style: styles25.row, children: [
|
|
3949
3966
|
inline.map((l, i) => {
|
|
3950
3967
|
const Icon = SOCIAL_PLATFORM_ICON[l.platform] ?? LinkIcon;
|
|
3951
|
-
return /* @__PURE__ */ (0,
|
|
3952
|
-
|
|
3968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3969
|
+
import_react_native33.Pressable,
|
|
3953
3970
|
{
|
|
3954
3971
|
onLayout: i === 0 ? (e) => {
|
|
3955
3972
|
firstPillY.current = e.nativeEvent.layout.y;
|
|
3956
3973
|
} : void 0,
|
|
3957
|
-
onPress: () => void
|
|
3958
|
-
style: [
|
|
3974
|
+
onPress: () => void import_react_native33.Linking.openURL(l.url),
|
|
3975
|
+
style: [styles25.pill, { backgroundColor: tokens["surface-2"] }],
|
|
3959
3976
|
children: [
|
|
3960
|
-
/* @__PURE__ */ (0,
|
|
3961
|
-
/* @__PURE__ */ (0,
|
|
3977
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { size: 15, color: tokens["text-2"] }),
|
|
3978
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_native33.Text, { style: { color: tokens["text-2"], fontSize: 12.5 }, children: l.platform })
|
|
3962
3979
|
]
|
|
3963
3980
|
},
|
|
3964
3981
|
`${l.platform}-${i}`
|
|
3965
3982
|
);
|
|
3966
3983
|
}),
|
|
3967
|
-
hasMore && /* @__PURE__ */ (0,
|
|
3968
|
-
|
|
3984
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3985
|
+
import_react_native33.Pressable,
|
|
3969
3986
|
{
|
|
3970
3987
|
onLayout: (e) => {
|
|
3971
3988
|
if (!shrunk.current && maxInline > 2 && firstPillY.current !== null && e.nativeEvent.layout.y > firstPillY.current) {
|
|
@@ -3974,15 +3991,15 @@ function SocialLinks({ links, onEditProfile }) {
|
|
|
3974
3991
|
}
|
|
3975
3992
|
},
|
|
3976
3993
|
onPress: () => setViewAllOpen(true),
|
|
3977
|
-
style: [
|
|
3994
|
+
style: [styles25.pill, { backgroundColor: tokens["surface-2"] }],
|
|
3978
3995
|
children: [
|
|
3979
|
-
/* @__PURE__ */ (0,
|
|
3980
|
-
/* @__PURE__ */ (0,
|
|
3996
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_native33.Text, { style: { color: tokens["text-2"], fontSize: 12.5 }, children: "View all" }),
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronRightIcon, { size: 13, color: tokens["text-2"] })
|
|
3981
3998
|
]
|
|
3982
3999
|
}
|
|
3983
4000
|
)
|
|
3984
4001
|
] }),
|
|
3985
|
-
viewAllOpen && /* @__PURE__ */ (0,
|
|
4002
|
+
viewAllOpen && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3986
4003
|
AllSocialLinksSheet,
|
|
3987
4004
|
{
|
|
3988
4005
|
links,
|
|
@@ -3995,18 +4012,18 @@ function SocialLinks({ links, onEditProfile }) {
|
|
|
3995
4012
|
)
|
|
3996
4013
|
] });
|
|
3997
4014
|
}
|
|
3998
|
-
var
|
|
4015
|
+
var styles25 = import_react_native33.StyleSheet.create({
|
|
3999
4016
|
row: { flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 12 },
|
|
4000
4017
|
pill: { flexDirection: "row", alignItems: "center", gap: 6, borderRadius: 999, paddingVertical: 7, paddingHorizontal: 12 }
|
|
4001
4018
|
});
|
|
4002
4019
|
|
|
4003
4020
|
// src/profile/ProfileCommentCard.tsx
|
|
4004
|
-
var
|
|
4021
|
+
var import_react_native35 = require("react-native");
|
|
4005
4022
|
|
|
4006
4023
|
// src/components/RenderedBody.tsx
|
|
4007
|
-
var
|
|
4008
|
-
var
|
|
4009
|
-
var
|
|
4024
|
+
var import_react22 = require("react");
|
|
4025
|
+
var import_react_native34 = require("react-native");
|
|
4026
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4010
4027
|
function parseBlocks(body) {
|
|
4011
4028
|
const lines = body.replace(/\r\n/g, "\n").split("\n");
|
|
4012
4029
|
const blocks = [];
|
|
@@ -4100,23 +4117,23 @@ function renderInline(text, keyPrefix, linkColor, codeBg) {
|
|
|
4100
4117
|
return parts.map((part, i) => {
|
|
4101
4118
|
const key = `${keyPrefix}-${i}`;
|
|
4102
4119
|
if (part.startsWith("**") && part.endsWith("**")) {
|
|
4103
|
-
return /* @__PURE__ */ (0,
|
|
4120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { fontWeight: "700" }, children: part.slice(2, -2) }, key);
|
|
4104
4121
|
}
|
|
4105
4122
|
if (part.startsWith("~~") && part.endsWith("~~")) {
|
|
4106
|
-
return /* @__PURE__ */ (0,
|
|
4123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { textDecorationLine: "line-through" }, children: part.slice(2, -2) }, key);
|
|
4107
4124
|
}
|
|
4108
4125
|
if (part.startsWith("`") && part.endsWith("`")) {
|
|
4109
|
-
return /* @__PURE__ */ (0,
|
|
4126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { fontFamily: "Courier", backgroundColor: codeBg, borderRadius: 4 }, children: part.slice(1, -1) }, key);
|
|
4110
4127
|
}
|
|
4111
4128
|
if (part.startsWith("*") && part.endsWith("*")) {
|
|
4112
|
-
return /* @__PURE__ */ (0,
|
|
4129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { fontStyle: "italic" }, children: part.slice(1, -1) }, key);
|
|
4113
4130
|
}
|
|
4114
4131
|
const linkMatch = /^\[([^\]]*)\]\(([^)]+)\)$/.exec(part);
|
|
4115
4132
|
if (linkMatch) {
|
|
4116
4133
|
const label = linkMatch[1];
|
|
4117
4134
|
const url = linkMatch[2] ?? "";
|
|
4118
|
-
return /* @__PURE__ */ (0,
|
|
4119
|
-
void
|
|
4135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { color: linkColor }, onPress: () => {
|
|
4136
|
+
void import_react_native34.Linking.openURL(url);
|
|
4120
4137
|
}, children: label && label.length > 0 ? label : url }, key);
|
|
4121
4138
|
}
|
|
4122
4139
|
return part;
|
|
@@ -4124,34 +4141,34 @@ function renderInline(text, keyPrefix, linkColor, codeBg) {
|
|
|
4124
4141
|
}
|
|
4125
4142
|
function RenderedBody({ body, size = 14.5 }) {
|
|
4126
4143
|
const { tokens } = useTheme();
|
|
4127
|
-
const blocks = (0,
|
|
4144
|
+
const blocks = (0, import_react22.useMemo)(() => parseBlocks(body), [body]);
|
|
4128
4145
|
const line = Math.round(size * 1.5);
|
|
4129
4146
|
const textColor = tokens["text-2"];
|
|
4130
|
-
return /* @__PURE__ */ (0,
|
|
4147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.View, { children: blocks.map((b, idx) => {
|
|
4131
4148
|
const key = `b-${idx}`;
|
|
4132
4149
|
switch (b.type) {
|
|
4133
4150
|
case "heading":
|
|
4134
|
-
return /* @__PURE__ */ (0,
|
|
4151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { color: tokens.text, fontSize: size + (4 - b.level) * 2, fontWeight: "800", marginBottom: 8 }, children: renderInline(b.text, key, tokens.accent, tokens["surface-2"]) }, key);
|
|
4135
4152
|
case "blockquote":
|
|
4136
|
-
return /* @__PURE__ */ (0,
|
|
4153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.View, { style: [styles26.blockquote, { backgroundColor: tokens["surface-2"], borderLeftColor: tokens["border-strong"] }], children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { color: textColor, fontSize: size, lineHeight: line }, children: renderInline(b.text, key, tokens.accent, tokens.elev) }) }, key);
|
|
4137
4154
|
case "list":
|
|
4138
|
-
return /* @__PURE__ */ (0,
|
|
4139
|
-
/* @__PURE__ */ (0,
|
|
4140
|
-
/* @__PURE__ */ (0,
|
|
4155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.View, { style: styles26.list, children: b.items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_native34.View, { style: styles26.listRow, children: [
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { color: textColor, fontSize: size, lineHeight: line }, children: b.ordered ? `${i + 1}.` : "\u2022" }),
|
|
4157
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { color: textColor, fontSize: size, lineHeight: line, flex: 1 }, children: renderInline(item, `${key}-${i}`, tokens.accent, tokens.elev) })
|
|
4141
4158
|
] }, `${key}-${i}`)) }, key);
|
|
4142
4159
|
case "code":
|
|
4143
|
-
return /* @__PURE__ */ (0,
|
|
4160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.View, { style: [styles26.codeBlock, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { color: tokens.text, fontFamily: "Courier", fontSize: size - 1 }, children: b.text }) }, key);
|
|
4144
4161
|
case "hr":
|
|
4145
|
-
return /* @__PURE__ */ (0,
|
|
4162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.View, { style: [styles26.hr, { backgroundColor: tokens.border }] }, key);
|
|
4146
4163
|
case "image":
|
|
4147
|
-
return /* @__PURE__ */ (0,
|
|
4164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Image, { source: { uri: b.url }, style: [styles26.image, { backgroundColor: tokens["surface-2"] }], resizeMode: "cover" }, key);
|
|
4148
4165
|
case "paragraph":
|
|
4149
4166
|
default:
|
|
4150
|
-
return /* @__PURE__ */ (0,
|
|
4167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native34.Text, { style: { color: textColor, fontSize: size, lineHeight: line, marginBottom: 10 }, children: renderInline(b.text, key, tokens.accent, tokens.elev) }, key);
|
|
4151
4168
|
}
|
|
4152
4169
|
}) });
|
|
4153
4170
|
}
|
|
4154
|
-
var
|
|
4171
|
+
var styles26 = import_react_native34.StyleSheet.create({
|
|
4155
4172
|
blockquote: { borderLeftWidth: 3, borderRadius: 6, paddingHorizontal: 12, paddingVertical: 6, marginBottom: 10 },
|
|
4156
4173
|
list: { marginBottom: 10 },
|
|
4157
4174
|
listRow: { flexDirection: "row", gap: 6, marginBottom: 4 },
|
|
@@ -4161,43 +4178,43 @@ var styles25 = import_react_native33.StyleSheet.create({
|
|
|
4161
4178
|
});
|
|
4162
4179
|
|
|
4163
4180
|
// src/profile/ProfileCommentCard.tsx
|
|
4164
|
-
var
|
|
4181
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4165
4182
|
function ProfileCommentCard({ comment, threadTitle, replyingTo, onOpen }) {
|
|
4166
4183
|
const { tokens } = useTheme();
|
|
4167
4184
|
const voteCounts = comment.voteCounts ?? { up: 0, down: 0 };
|
|
4168
|
-
return /* @__PURE__ */ (0,
|
|
4169
|
-
/* @__PURE__ */ (0,
|
|
4170
|
-
/* @__PURE__ */ (0,
|
|
4171
|
-
/* @__PURE__ */ (0,
|
|
4185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.Pressable, { onPress: onOpen, style: [styles27.card, { borderBottomColor: tokens.border }], children: [
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.View, { style: styles27.head, children: [
|
|
4187
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native35.Text, { style: [styles27.author, { color: tokens.text }], children: comment.authorDisplayName ?? "Member" }),
|
|
4188
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.Text, { style: [styles27.time, { color: tokens.muted }], children: [
|
|
4172
4189
|
"\xB7 ",
|
|
4173
4190
|
fmtRelativeTime(comment.createdAt)
|
|
4174
4191
|
] })
|
|
4175
4192
|
] }),
|
|
4176
|
-
/* @__PURE__ */ (0,
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.Text, { style: [styles27.context, { color: tokens.muted }], children: [
|
|
4177
4194
|
"Commented on ",
|
|
4178
|
-
/* @__PURE__ */ (0,
|
|
4195
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native35.Text, { style: { color: tokens["text-2"], fontWeight: "600" }, children: threadTitle })
|
|
4179
4196
|
] }),
|
|
4180
|
-
replyingTo && /* @__PURE__ */ (0,
|
|
4197
|
+
replyingTo && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.Text, { style: [styles27.replying, { color: tokens.muted }], numberOfLines: 1, children: [
|
|
4181
4198
|
"Replying to ",
|
|
4182
|
-
/* @__PURE__ */ (0,
|
|
4199
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native35.Text, { style: { fontWeight: "700" }, children: replyingTo.author }),
|
|
4183
4200
|
": \u201C",
|
|
4184
4201
|
replyingTo.snippet,
|
|
4185
4202
|
"\u201D"
|
|
4186
4203
|
] }),
|
|
4187
|
-
/* @__PURE__ */ (0,
|
|
4188
|
-
/* @__PURE__ */ (0,
|
|
4189
|
-
/* @__PURE__ */ (0,
|
|
4190
|
-
/* @__PURE__ */ (0,
|
|
4191
|
-
/* @__PURE__ */ (0,
|
|
4204
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native35.View, { style: { marginTop: 4, maxHeight: 40, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RenderedBody, { body: comment.body, size: 13.5 }) }),
|
|
4205
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.View, { style: styles27.stats, children: [
|
|
4206
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.View, { style: styles27.stat, children: [
|
|
4207
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(UpvoteIcon, { size: 13, color: tokens.muted }),
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native35.Text, { style: [styles27.statN, { color: tokens.muted }], children: voteCounts.up })
|
|
4192
4209
|
] }),
|
|
4193
|
-
/* @__PURE__ */ (0,
|
|
4194
|
-
/* @__PURE__ */ (0,
|
|
4195
|
-
/* @__PURE__ */ (0,
|
|
4210
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native35.View, { style: styles27.stat, children: [
|
|
4211
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DownvoteIcon, { size: 13, color: tokens.muted }),
|
|
4212
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native35.Text, { style: [styles27.statN, { color: tokens.muted }], children: voteCounts.down })
|
|
4196
4213
|
] })
|
|
4197
4214
|
] })
|
|
4198
4215
|
] });
|
|
4199
4216
|
}
|
|
4200
|
-
var
|
|
4217
|
+
var styles27 = import_react_native35.StyleSheet.create({
|
|
4201
4218
|
card: { paddingVertical: 12, borderBottomWidth: 1 },
|
|
4202
4219
|
head: { flexDirection: "row", alignItems: "center", gap: 6 },
|
|
4203
4220
|
author: { fontSize: 13, fontWeight: "700" },
|
|
@@ -4210,7 +4227,7 @@ var styles26 = import_react_native34.StyleSheet.create({
|
|
|
4210
4227
|
});
|
|
4211
4228
|
|
|
4212
4229
|
// src/profile/UserProfileSheet.tsx
|
|
4213
|
-
var
|
|
4230
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4214
4231
|
var PUBLIC_TABS = ["Overview", "Posts", "Comments", "Upvoted", "Downvoted"];
|
|
4215
4232
|
var HANDLE_H = 32;
|
|
4216
4233
|
function UserProfileSheet({ userId, onClose }) {
|
|
@@ -4219,24 +4236,24 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4219
4236
|
const { apiUrl, forumId } = session;
|
|
4220
4237
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
4221
4238
|
const insets = (0, import_react_native_safe_area_context8.useSafeAreaInsets)();
|
|
4222
|
-
const { height: windowHeight } =
|
|
4239
|
+
const { height: windowHeight } = import_react_native36.Dimensions.get("window");
|
|
4223
4240
|
const SNAP_HALF = windowHeight * 0.52;
|
|
4224
4241
|
const SNAP_FULL = insets.top;
|
|
4225
4242
|
const SNAP_CLOSED = windowHeight;
|
|
4226
|
-
const sheetTop = (0,
|
|
4227
|
-
const lastMoveY = (0,
|
|
4228
|
-
const isAtFullRef = (0,
|
|
4229
|
-
const snapFullRef = (0,
|
|
4243
|
+
const sheetTop = (0, import_react23.useRef)(new import_react_native36.Animated.Value(SNAP_CLOSED)).current;
|
|
4244
|
+
const lastMoveY = (0, import_react23.useRef)(null);
|
|
4245
|
+
const isAtFullRef = (0, import_react23.useRef)(false);
|
|
4246
|
+
const snapFullRef = (0, import_react23.useRef)(insets.top);
|
|
4230
4247
|
snapFullRef.current = insets.top;
|
|
4231
|
-
const onCloseRef = (0,
|
|
4248
|
+
const onCloseRef = (0, import_react23.useRef)(onClose);
|
|
4232
4249
|
onCloseRef.current = onClose;
|
|
4233
|
-
const [scrollEnabled, setScrollEnabled] = (0,
|
|
4234
|
-
(0,
|
|
4250
|
+
const [scrollEnabled, setScrollEnabled] = (0, import_react23.useState)(false);
|
|
4251
|
+
(0, import_react23.useEffect)(() => {
|
|
4235
4252
|
const id = requestAnimationFrame(() => {
|
|
4236
|
-
|
|
4253
|
+
import_react_native36.Animated.timing(sheetTop, {
|
|
4237
4254
|
toValue: SNAP_HALF,
|
|
4238
4255
|
duration: 320,
|
|
4239
|
-
easing:
|
|
4256
|
+
easing: import_react_native36.Easing.out(import_react_native36.Easing.cubic),
|
|
4240
4257
|
useNativeDriver: false
|
|
4241
4258
|
}).start();
|
|
4242
4259
|
});
|
|
@@ -4247,12 +4264,12 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4247
4264
|
isAtFullRef.current = goingFull;
|
|
4248
4265
|
setScrollEnabled(goingFull);
|
|
4249
4266
|
if (target === SNAP_CLOSED) {
|
|
4250
|
-
|
|
4267
|
+
import_react_native36.Animated.timing(sheetTop, { toValue: SNAP_CLOSED, duration: 220, useNativeDriver: false }).start(done);
|
|
4251
4268
|
} else {
|
|
4252
|
-
|
|
4269
|
+
import_react_native36.Animated.spring(sheetTop, { toValue: target, useNativeDriver: false, bounciness: 4 }).start(done);
|
|
4253
4270
|
}
|
|
4254
4271
|
};
|
|
4255
|
-
const pan = (0,
|
|
4272
|
+
const pan = (0, import_react23.useRef)(import_react_native36.PanResponder.create({
|
|
4256
4273
|
onStartShouldSetPanResponder: () => true,
|
|
4257
4274
|
onMoveShouldSetPanResponder: () => true,
|
|
4258
4275
|
onPanResponderTerminationRequest: () => false,
|
|
@@ -4282,7 +4299,7 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4282
4299
|
snapTo(SNAP_HALF);
|
|
4283
4300
|
}
|
|
4284
4301
|
})).current;
|
|
4285
|
-
const contentPan = (0,
|
|
4302
|
+
const contentPan = (0, import_react23.useRef)(import_react_native36.PanResponder.create({
|
|
4286
4303
|
onMoveShouldSetPanResponder: (_e, g) => !isAtFullRef.current && Math.abs(g.dy) > 5,
|
|
4287
4304
|
onPanResponderTerminationRequest: () => false,
|
|
4288
4305
|
onPanResponderGrant: (_e, g) => {
|
|
@@ -4319,13 +4336,13 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4319
4336
|
function handleClose() {
|
|
4320
4337
|
snapTo(SNAP_CLOSED, onClose);
|
|
4321
4338
|
}
|
|
4322
|
-
const [profile, setProfile] = (0,
|
|
4323
|
-
const [loading, setLoading] = (0,
|
|
4324
|
-
const [activeTab, setActiveTab] = (0,
|
|
4325
|
-
const [activity, setActivity] = (0,
|
|
4326
|
-
const [activityLoading, setActivityLoading] = (0,
|
|
4327
|
-
const [previewUri, setPreviewUri] = (0,
|
|
4328
|
-
(0,
|
|
4339
|
+
const [profile, setProfile] = (0, import_react23.useState)(null);
|
|
4340
|
+
const [loading, setLoading] = (0, import_react23.useState)(true);
|
|
4341
|
+
const [activeTab, setActiveTab] = (0, import_react23.useState)("Overview");
|
|
4342
|
+
const [activity, setActivity] = (0, import_react23.useState)([]);
|
|
4343
|
+
const [activityLoading, setActivityLoading] = (0, import_react23.useState)(false);
|
|
4344
|
+
const [previewUri, setPreviewUri] = (0, import_react23.useState)(null);
|
|
4345
|
+
(0, import_react23.useEffect)(() => {
|
|
4329
4346
|
let cancelled = false;
|
|
4330
4347
|
setLoading(true);
|
|
4331
4348
|
getUserProfile(apiUrl, forumId, userId, token).then((p) => {
|
|
@@ -4337,7 +4354,7 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4337
4354
|
cancelled = true;
|
|
4338
4355
|
};
|
|
4339
4356
|
}, [apiUrl, forumId, userId, token]);
|
|
4340
|
-
(0,
|
|
4357
|
+
(0, import_react23.useEffect)(() => {
|
|
4341
4358
|
let cancelled = false;
|
|
4342
4359
|
setActivityLoading(true);
|
|
4343
4360
|
const scope = activeTab.toLowerCase();
|
|
@@ -4355,12 +4372,12 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4355
4372
|
}, [apiUrl, forumId, userId, token, activeTab]);
|
|
4356
4373
|
const name = profile?.displayName ?? "\u2026";
|
|
4357
4374
|
const copy = profileEmptyCopy(activeTab);
|
|
4358
|
-
return /* @__PURE__ */ (0,
|
|
4359
|
-
/* @__PURE__ */ (0,
|
|
4360
|
-
/* @__PURE__ */ (0,
|
|
4361
|
-
|
|
4375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.Modal, { transparent: true, visible: true, animationType: "none", statusBarTranslucent: true, onRequestClose: handleClose, children: [
|
|
4376
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Animated.View, { style: [styles28.scrim, { opacity: scrimOpacity }], pointerEvents: "none" }),
|
|
4377
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4378
|
+
import_react_native36.View,
|
|
4362
4379
|
{
|
|
4363
|
-
style:
|
|
4380
|
+
style: import_react_native36.StyleSheet.absoluteFill,
|
|
4364
4381
|
onStartShouldSetResponder: (e) => {
|
|
4365
4382
|
const sheetY = sheetTop._value;
|
|
4366
4383
|
return e.nativeEvent.pageY < sheetY;
|
|
@@ -4368,56 +4385,56 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4368
4385
|
onResponderRelease: () => handleClose()
|
|
4369
4386
|
}
|
|
4370
4387
|
),
|
|
4371
|
-
/* @__PURE__ */ (0,
|
|
4372
|
-
/* @__PURE__ */ (0,
|
|
4373
|
-
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Animated.View, { style: [styles28.sheet, { backgroundColor: tokens.bg, top: sheetTop }], children: loading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: styles28.center, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Mascot, { size: 36 }) }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: styles28.scrollWrap, ...contentPan.panHandlers, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.ScrollView, { scrollEnabled, contentContainerStyle: styles28.content, scrollEventThrottle: 16, children: [
|
|
4389
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4390
|
+
import_react_native36.Pressable,
|
|
4374
4391
|
{
|
|
4375
4392
|
onPress: () => profile?.bannerUrl && setPreviewUri(profile.bannerUrl),
|
|
4376
4393
|
disabled: !profile?.bannerUrl,
|
|
4377
|
-
style: [
|
|
4394
|
+
style: [styles28.banner, { backgroundColor: tokens["surface-2"] }],
|
|
4378
4395
|
children: [
|
|
4379
|
-
profile?.bannerUrl != null && /* @__PURE__ */ (0,
|
|
4380
|
-
/* @__PURE__ */ (0,
|
|
4381
|
-
|
|
4396
|
+
profile?.bannerUrl != null && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Image, { source: { uri: profile.bannerUrl }, style: import_react_native36.StyleSheet.absoluteFill }),
|
|
4397
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: styles28.avatarWrap, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4398
|
+
import_react_native36.Pressable,
|
|
4382
4399
|
{
|
|
4383
4400
|
onPress: () => profile?.avatarUrl && setPreviewUri(profile.avatarUrl),
|
|
4384
4401
|
disabled: !profile?.avatarUrl,
|
|
4385
|
-
style: [
|
|
4386
|
-
children: /* @__PURE__ */ (0,
|
|
4402
|
+
style: [styles28.avatarRing, { borderColor: tokens.bg }],
|
|
4403
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Avatar, { authorId: profile?.id, author: name, avatarUrl: profile?.avatarUrl, size: 72 })
|
|
4387
4404
|
}
|
|
4388
4405
|
) })
|
|
4389
4406
|
]
|
|
4390
4407
|
}
|
|
4391
4408
|
),
|
|
4392
|
-
/* @__PURE__ */ (0,
|
|
4393
|
-
/* @__PURE__ */ (0,
|
|
4394
|
-
/* @__PURE__ */ (0,
|
|
4395
|
-
/* @__PURE__ */ (0,
|
|
4409
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.View, { style: { paddingHorizontal: 16 }, children: [
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: styles28.nameRow, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.View, { style: { flex: 1 }, children: [
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.displayName, { color: tokens.text }], children: name }),
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.Text, { style: [styles28.username, { color: tokens.muted }], children: [
|
|
4396
4413
|
"/",
|
|
4397
4414
|
name
|
|
4398
4415
|
] })
|
|
4399
4416
|
] }) }),
|
|
4400
|
-
profile?.bio != null && profile.bio.trim().length > 0 && /* @__PURE__ */ (0,
|
|
4401
|
-
profile && /* @__PURE__ */ (0,
|
|
4417
|
+
profile?.bio != null && profile.bio.trim().length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.bio, { color: tokens["text-2"] }], children: profile.bio }),
|
|
4418
|
+
profile && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SocialLinks, { links: profile.socialLinks })
|
|
4402
4419
|
] }),
|
|
4403
|
-
/* @__PURE__ */ (0,
|
|
4404
|
-
/* @__PURE__ */ (0,
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
4406
|
-
/* @__PURE__ */ (0,
|
|
4420
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.View, { style: [styles28.karmaRow, { borderTopColor: tokens.border }], children: [
|
|
4421
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.View, { style: styles28.karmaBlock, children: [
|
|
4422
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.karmaValue, { color: tokens.text }], children: (profile?.postKarma ?? 0).toLocaleString() }),
|
|
4423
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.karmaLabel, { color: tokens.muted }], children: "Post Karma" })
|
|
4407
4424
|
] }),
|
|
4408
|
-
/* @__PURE__ */ (0,
|
|
4409
|
-
/* @__PURE__ */ (0,
|
|
4410
|
-
/* @__PURE__ */ (0,
|
|
4411
|
-
/* @__PURE__ */ (0,
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: [styles28.karmaDivider, { backgroundColor: tokens.border }] }),
|
|
4426
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.View, { style: styles28.karmaBlock, children: [
|
|
4427
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.karmaValue, { color: tokens.text }], children: (profile?.commentKarma ?? 0).toLocaleString() }),
|
|
4428
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.karmaLabel, { color: tokens.muted }], children: "Comment Karma" })
|
|
4412
4429
|
] })
|
|
4413
4430
|
] }),
|
|
4414
|
-
/* @__PURE__ */ (0,
|
|
4415
|
-
/* @__PURE__ */ (0,
|
|
4416
|
-
activityLoading ? /* @__PURE__ */ (0,
|
|
4417
|
-
/* @__PURE__ */ (0,
|
|
4418
|
-
/* @__PURE__ */ (0,
|
|
4419
|
-
/* @__PURE__ */ (0,
|
|
4420
|
-
] }) : /* @__PURE__ */ (0,
|
|
4431
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: [styles28.divider, { backgroundColor: tokens.border }] }),
|
|
4432
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: { marginTop: 6, marginBottom: 14 }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TabPills, { tabs: PUBLIC_TABS, active: activeTab, onSelect: setActiveTab }) }),
|
|
4433
|
+
activityLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: { alignItems: "center", paddingVertical: 30 }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Mascot, { size: 36 }) }) : activity.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_native36.View, { style: styles28.empty, children: [
|
|
4434
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Mascot, { size: 88, animated: false, badge: false }),
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.emptyTitle, { color: tokens.text }], children: copy.title }),
|
|
4436
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.Text, { style: [styles28.emptyDesc, { color: tokens.muted }], children: copy.description })
|
|
4437
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: { paddingHorizontal: 16 }, children: activity.map((a, i) => a.kind === "thread" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4421
4438
|
PostRow,
|
|
4422
4439
|
{
|
|
4423
4440
|
row: a.row,
|
|
@@ -4434,7 +4451,7 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4434
4451
|
}
|
|
4435
4452
|
},
|
|
4436
4453
|
`t-${a.row.id}-${i}`
|
|
4437
|
-
) : /* @__PURE__ */ (0,
|
|
4454
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4438
4455
|
ProfileCommentCard,
|
|
4439
4456
|
{
|
|
4440
4457
|
comment: a.comment,
|
|
@@ -4446,21 +4463,21 @@ function UserProfileSheet({ userId, onClose }) {
|
|
|
4446
4463
|
`c-${a.comment.id}-${i}`
|
|
4447
4464
|
)) })
|
|
4448
4465
|
] }) }) }),
|
|
4449
|
-
/* @__PURE__ */ (0,
|
|
4450
|
-
|
|
4466
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4467
|
+
import_react_native36.Animated.View,
|
|
4451
4468
|
{
|
|
4452
|
-
style: [
|
|
4469
|
+
style: [styles28.handleBar, { backgroundColor: tokens.bg, top: sheetTop }],
|
|
4453
4470
|
children: [
|
|
4454
|
-
/* @__PURE__ */ (0,
|
|
4455
|
-
/* @__PURE__ */ (0,
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: [styles28.pill, { backgroundColor: tokens["surface-2"] }] }),
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_native36.View, { style: import_react_native36.StyleSheet.absoluteFill, ...pan.panHandlers })
|
|
4456
4473
|
]
|
|
4457
4474
|
}
|
|
4458
4475
|
),
|
|
4459
|
-
previewUri && /* @__PURE__ */ (0,
|
|
4476
|
+
previewUri && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ImageLightbox, { uri: previewUri, onClose: () => setPreviewUri(null) })
|
|
4460
4477
|
] });
|
|
4461
4478
|
}
|
|
4462
|
-
var
|
|
4463
|
-
scrim: { ...
|
|
4479
|
+
var styles28 = import_react_native36.StyleSheet.create({
|
|
4480
|
+
scrim: { ...import_react_native36.StyleSheet.absoluteFill, backgroundColor: "rgba(0,0,0,1)" },
|
|
4464
4481
|
sheet: {
|
|
4465
4482
|
position: "absolute",
|
|
4466
4483
|
left: 0,
|
|
@@ -4507,7 +4524,7 @@ var styles27 = import_react_native35.StyleSheet.create({
|
|
|
4507
4524
|
});
|
|
4508
4525
|
|
|
4509
4526
|
// src/screens/FeedScreen.tsx
|
|
4510
|
-
var
|
|
4527
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4511
4528
|
var SORT_OPTIONS = ["Best", "Hot", "New", "Top", "Rising"];
|
|
4512
4529
|
var SORT_QUERY = {
|
|
4513
4530
|
Best: "best",
|
|
@@ -4528,23 +4545,23 @@ function FeedBody() {
|
|
|
4528
4545
|
const session = useSession();
|
|
4529
4546
|
const navigation = (0, import_native4.useNavigation)();
|
|
4530
4547
|
const onScroll = useScrollCollapse();
|
|
4531
|
-
const [sort, setSort] = (0,
|
|
4532
|
-
const [rows, setRows] = (0,
|
|
4533
|
-
const [loading, setLoading] = (0,
|
|
4534
|
-
const [error, setError] = (0,
|
|
4535
|
-
const [reportId, setReportId] = (0,
|
|
4536
|
-
const [shareId, setShareId] = (0,
|
|
4537
|
-
const [viewingUserId, setViewingUserId] = (0,
|
|
4548
|
+
const [sort, setSort] = (0, import_react24.useState)("Best");
|
|
4549
|
+
const [rows, setRows] = (0, import_react24.useState)([]);
|
|
4550
|
+
const [loading, setLoading] = (0, import_react24.useState)(true);
|
|
4551
|
+
const [error, setError] = (0, import_react24.useState)(null);
|
|
4552
|
+
const [reportId, setReportId] = (0, import_react24.useState)(null);
|
|
4553
|
+
const [shareId, setShareId] = (0, import_react24.useState)(null);
|
|
4554
|
+
const [viewingUserId, setViewingUserId] = (0, import_react24.useState)(null);
|
|
4538
4555
|
const currentUserId = session.status === "ready" ? session.userId : null;
|
|
4539
4556
|
const route = (0, import_native4.useRoute)();
|
|
4540
4557
|
const scope = route.params?.scope ?? "home";
|
|
4541
4558
|
const { apiUrl, forumId } = session;
|
|
4542
4559
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
4543
|
-
(0,
|
|
4560
|
+
(0, import_react24.useEffect)(() => {
|
|
4544
4561
|
if (scope === "popular") setSort("Hot");
|
|
4545
4562
|
else if (scope === "home") setSort("Best");
|
|
4546
4563
|
}, [scope]);
|
|
4547
|
-
const load = (0,
|
|
4564
|
+
const load = (0, import_react24.useCallback)(async (s) => {
|
|
4548
4565
|
if (!token) return;
|
|
4549
4566
|
setLoading(true);
|
|
4550
4567
|
setError(null);
|
|
@@ -4561,13 +4578,13 @@ function FeedBody() {
|
|
|
4561
4578
|
setLoading(false);
|
|
4562
4579
|
}
|
|
4563
4580
|
}, [apiUrl, forumId, token, scope]);
|
|
4564
|
-
(0,
|
|
4581
|
+
(0, import_react24.useEffect)(() => {
|
|
4565
4582
|
void load(sort);
|
|
4566
4583
|
}, [load, sort]);
|
|
4567
|
-
const updateRow = (0,
|
|
4584
|
+
const updateRow = (0, import_react24.useCallback)((id, fn) => {
|
|
4568
4585
|
setRows((prev) => prev.map((r) => r.id === id ? fn(r) : r));
|
|
4569
4586
|
}, []);
|
|
4570
|
-
const onVote = (0,
|
|
4587
|
+
const onVote = (0, import_react24.useCallback)((row, dir) => {
|
|
4571
4588
|
if (!token) return;
|
|
4572
4589
|
const oldDir = row.myVote;
|
|
4573
4590
|
const newDir = nextVoteDir(oldDir, dir);
|
|
@@ -4576,24 +4593,24 @@ function FeedBody() {
|
|
|
4576
4593
|
const req = newDir === null ? removeVoteFromThread(apiUrl, forumId, row.id, token) : voteOnThread(apiUrl, forumId, row.id, newDir, token);
|
|
4577
4594
|
req.then((res) => updateRow(row.id, (r) => ({ ...r, myVote: res.myVote, voteCounts: res.voteCounts }))).catch(() => updateRow(row.id, (r) => ({ ...r, myVote: oldDir, voteCounts: prevCounts })));
|
|
4578
4595
|
}, [apiUrl, forumId, token, updateRow]);
|
|
4579
|
-
const onSave = (0,
|
|
4596
|
+
const onSave = (0, import_react24.useCallback)((row) => {
|
|
4580
4597
|
if (!token) return;
|
|
4581
4598
|
const newSaved = !row.saved;
|
|
4582
4599
|
updateRow(row.id, (r) => ({ ...r, saved: newSaved }));
|
|
4583
4600
|
const req = newSaved ? saveThread(apiUrl, forumId, row.id, token) : unsaveThread(apiUrl, forumId, row.id, token);
|
|
4584
4601
|
req.catch(() => updateRow(row.id, (r) => ({ ...r, saved: !newSaved })));
|
|
4585
4602
|
}, [apiUrl, forumId, token, updateRow]);
|
|
4586
|
-
const submitReport = (0,
|
|
4603
|
+
const submitReport = (0, import_react24.useCallback)((reason) => {
|
|
4587
4604
|
if (!token || !reportId) return;
|
|
4588
4605
|
void reportThread(apiUrl, forumId, reportId, reason, token).catch(() => {
|
|
4589
4606
|
});
|
|
4590
4607
|
}, [apiUrl, forumId, token, reportId]);
|
|
4591
|
-
const submitShare = (0,
|
|
4608
|
+
const submitShare = (0, import_react24.useCallback)((recipientIds) => {
|
|
4592
4609
|
if (!token || !shareId || recipientIds.length === 0) return;
|
|
4593
4610
|
void shareThreadWithUsers(apiUrl, forumId, shareId, recipientIds, void 0, token).catch(() => {
|
|
4594
4611
|
});
|
|
4595
4612
|
}, [apiUrl, forumId, token, shareId]);
|
|
4596
|
-
const controls = /* @__PURE__ */ (0,
|
|
4613
|
+
const controls = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_native37.View, { style: styles29.controls, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4597
4614
|
SelectPill,
|
|
4598
4615
|
{
|
|
4599
4616
|
value: sort,
|
|
@@ -4602,20 +4619,20 @@ function FeedBody() {
|
|
|
4602
4619
|
label: sort,
|
|
4603
4620
|
optionIcon: (s) => {
|
|
4604
4621
|
const Icon = SORT_ICON[s];
|
|
4605
|
-
return /* @__PURE__ */ (0,
|
|
4622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Icon, { size: 16, color: tokens["text-2"] });
|
|
4606
4623
|
}
|
|
4607
4624
|
}
|
|
4608
4625
|
) });
|
|
4609
|
-
return /* @__PURE__ */ (0,
|
|
4610
|
-
loading && rows.length === 0 ? /* @__PURE__ */ (0,
|
|
4611
|
-
|
|
4626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
4627
|
+
loading && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_native37.View, { style: styles29.center, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Mascot, { size: 36 }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_native37.View, { style: styles29.center, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_native37.Text, { style: { color: tokens["text-2"], fontSize: 14 }, children: error }) }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4628
|
+
import_react_native37.FlatList,
|
|
4612
4629
|
{
|
|
4613
4630
|
data: rows,
|
|
4614
4631
|
keyExtractor: (r) => r.id,
|
|
4615
4632
|
onScroll,
|
|
4616
4633
|
scrollEventThrottle: 16,
|
|
4617
4634
|
ListHeaderComponent: controls,
|
|
4618
|
-
renderItem: ({ item }) => /* @__PURE__ */ (0,
|
|
4635
|
+
renderItem: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4619
4636
|
PostRow,
|
|
4620
4637
|
{
|
|
4621
4638
|
row: item,
|
|
@@ -4630,19 +4647,19 @@ function FeedBody() {
|
|
|
4630
4647
|
}
|
|
4631
4648
|
}
|
|
4632
4649
|
),
|
|
4633
|
-
ListEmptyComponent: /* @__PURE__ */ (0,
|
|
4650
|
+
ListEmptyComponent: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_native37.View, { style: styles29.center, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_native37.Text, { style: { color: tokens["text-2"], fontSize: 14 }, children: "No posts yet" }) }),
|
|
4634
4651
|
contentContainerStyle: { paddingBottom: 100 }
|
|
4635
4652
|
}
|
|
4636
4653
|
),
|
|
4637
|
-
reportId && /* @__PURE__ */ (0,
|
|
4638
|
-
shareId && /* @__PURE__ */ (0,
|
|
4639
|
-
viewingUserId && /* @__PURE__ */ (0,
|
|
4654
|
+
reportId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ReportSheet, { target: "post", onClose: () => setReportId(null), onSubmit: submitReport }),
|
|
4655
|
+
shareId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ShareSheet, { apiUrl, forumId, token, onClose: () => setShareId(null), onShare: submitShare }),
|
|
4656
|
+
viewingUserId && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UserProfileSheet, { userId: viewingUserId, onClose: () => setViewingUserId(null) })
|
|
4640
4657
|
] });
|
|
4641
4658
|
}
|
|
4642
4659
|
function FeedScreen() {
|
|
4643
|
-
return /* @__PURE__ */ (0,
|
|
4660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FeedBody, {}) });
|
|
4644
4661
|
}
|
|
4645
|
-
var
|
|
4662
|
+
var styles29 = import_react_native37.StyleSheet.create({
|
|
4646
4663
|
controls: {
|
|
4647
4664
|
flexDirection: "row",
|
|
4648
4665
|
alignItems: "center",
|
|
@@ -4660,28 +4677,28 @@ var styles28 = import_react_native36.StyleSheet.create({
|
|
|
4660
4677
|
});
|
|
4661
4678
|
|
|
4662
4679
|
// src/screens/ThreadScreen.tsx
|
|
4663
|
-
var
|
|
4664
|
-
var
|
|
4680
|
+
var import_react29 = require("react");
|
|
4681
|
+
var import_react_native44 = require("react-native");
|
|
4665
4682
|
var import_native5 = require("@react-navigation/native");
|
|
4666
4683
|
|
|
4667
4684
|
// src/components/MediaGallery.tsx
|
|
4668
|
-
var
|
|
4669
|
-
var
|
|
4670
|
-
var
|
|
4685
|
+
var import_react25 = require("react");
|
|
4686
|
+
var import_react_native38 = require("react-native");
|
|
4687
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4671
4688
|
function MediaGallery({ attachments, radius = 14, aspectRatio = 4 / 5 }) {
|
|
4672
4689
|
const { tokens } = useTheme();
|
|
4673
|
-
const { width: windowWidth } = (0,
|
|
4674
|
-
const [index, setIndex] = (0,
|
|
4675
|
-
const [previewUri, setPreviewUri] = (0,
|
|
4690
|
+
const { width: windowWidth } = (0, import_react_native38.useWindowDimensions)();
|
|
4691
|
+
const [index, setIndex] = (0, import_react25.useState)(0);
|
|
4692
|
+
const [previewUri, setPreviewUri] = (0, import_react25.useState)(null);
|
|
4676
4693
|
const slideWidth = windowWidth - 32;
|
|
4677
4694
|
if (attachments.length === 0) return null;
|
|
4678
4695
|
function onScrollEnd(e) {
|
|
4679
4696
|
setIndex(Math.round(e.nativeEvent.contentOffset.x / slideWidth));
|
|
4680
4697
|
}
|
|
4681
|
-
return /* @__PURE__ */ (0,
|
|
4682
|
-
/* @__PURE__ */ (0,
|
|
4683
|
-
/* @__PURE__ */ (0,
|
|
4684
|
-
|
|
4698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native38.View, { style: { marginBottom: 16 }, children: [
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native38.View, { style: { borderRadius: radius, overflow: "hidden" }, children: [
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4701
|
+
import_react_native38.ScrollView,
|
|
4685
4702
|
{
|
|
4686
4703
|
horizontal: true,
|
|
4687
4704
|
pagingEnabled: true,
|
|
@@ -4689,25 +4706,25 @@ function MediaGallery({ attachments, radius = 14, aspectRatio = 4 / 5 }) {
|
|
|
4689
4706
|
onMomentumScrollEnd: onScrollEnd,
|
|
4690
4707
|
children: attachments.map((a) => {
|
|
4691
4708
|
const isVideo = a.mimeType.startsWith("video/");
|
|
4692
|
-
return /* @__PURE__ */ (0,
|
|
4693
|
-
|
|
4709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4710
|
+
import_react_native38.Pressable,
|
|
4694
4711
|
{
|
|
4695
4712
|
disabled: isVideo,
|
|
4696
4713
|
onPress: () => setPreviewUri(a.downloadUrl),
|
|
4697
|
-
style: [
|
|
4698
|
-
children: isVideo ? /* @__PURE__ */ (0,
|
|
4714
|
+
style: [styles30.slide, { width: slideWidth, aspectRatio, backgroundColor: tokens["surface-2"] }],
|
|
4715
|
+
children: isVideo ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(InlineVideoThumb, { uri: a.downloadUrl, style: styles30.media, contentFit: "contain" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native38.Image, { source: { uri: a.downloadUrl }, style: styles30.media, resizeMode: "cover" })
|
|
4699
4716
|
},
|
|
4700
4717
|
a.id
|
|
4701
4718
|
);
|
|
4702
4719
|
})
|
|
4703
4720
|
}
|
|
4704
4721
|
),
|
|
4705
|
-
attachments.length > 1 && /* @__PURE__ */ (0,
|
|
4722
|
+
attachments.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native38.View, { style: styles30.dots, children: attachments.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native38.View, { style: [styles30.dot, { backgroundColor: i === index ? "#fff" : "rgba(255,255,255,0.5)" }] }, a.id)) })
|
|
4706
4723
|
] }),
|
|
4707
|
-
previewUri && /* @__PURE__ */ (0,
|
|
4724
|
+
previewUri && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ImageLightbox, { uri: previewUri, onClose: () => setPreviewUri(null) })
|
|
4708
4725
|
] });
|
|
4709
4726
|
}
|
|
4710
|
-
var
|
|
4727
|
+
var styles30 = import_react_native38.StyleSheet.create({
|
|
4711
4728
|
slide: {},
|
|
4712
4729
|
media: { width: "100%", height: "100%" },
|
|
4713
4730
|
dots: {
|
|
@@ -4723,17 +4740,17 @@ var styles29 = import_react_native37.StyleSheet.create({
|
|
|
4723
4740
|
});
|
|
4724
4741
|
|
|
4725
4742
|
// src/components/BackRow.tsx
|
|
4726
|
-
var
|
|
4727
|
-
var
|
|
4743
|
+
var import_react_native39 = require("react-native");
|
|
4744
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4728
4745
|
function BackRow({ onPress, label = "Back" }) {
|
|
4729
4746
|
const { tokens } = useTheme();
|
|
4730
|
-
const BackIcon =
|
|
4731
|
-
return /* @__PURE__ */ (0,
|
|
4732
|
-
/* @__PURE__ */ (0,
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
4747
|
+
const BackIcon = import_react_native39.Platform.OS === "ios" ? ChevronLeftIcon : MaterialBackIcon;
|
|
4748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_native39.View, { style: styles31.wrap, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_native39.Pressable, { onPress, hitSlop: 6, style: [styles31.pill, { backgroundColor: tokens["surface-2"] }], children: [
|
|
4749
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BackIcon, { size: 16, color: tokens["text-2"] }),
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_native39.Text, { style: [styles31.label, { color: tokens["text-2"] }], children: label })
|
|
4734
4751
|
] }) });
|
|
4735
4752
|
}
|
|
4736
|
-
var
|
|
4753
|
+
var styles31 = import_react_native39.StyleSheet.create({
|
|
4737
4754
|
wrap: { flexDirection: "row" },
|
|
4738
4755
|
pill: {
|
|
4739
4756
|
flexDirection: "row",
|
|
@@ -4747,21 +4764,21 @@ var styles30 = import_react_native38.StyleSheet.create({
|
|
|
4747
4764
|
});
|
|
4748
4765
|
|
|
4749
4766
|
// src/components/ConfirmDialog.tsx
|
|
4750
|
-
var
|
|
4751
|
-
var
|
|
4767
|
+
var import_react_native40 = require("react-native");
|
|
4768
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4752
4769
|
function ConfirmDialog({ title, message, confirmLabel = "Delete", onCancel, onConfirm }) {
|
|
4753
4770
|
const { tokens } = useTheme();
|
|
4754
|
-
return /* @__PURE__ */ (0,
|
|
4771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Modal, { transparent: true, visible: true, animationType: "fade", statusBarTranslucent: true, onRequestClose: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Pressable, { style: styles32.scrim, onPress: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native40.Pressable, { style: [styles32.card, { backgroundColor: tokens.elev, borderColor: tokens.border }], onPress: () => {
|
|
4755
4772
|
}, children: [
|
|
4756
|
-
/* @__PURE__ */ (0,
|
|
4757
|
-
message && /* @__PURE__ */ (0,
|
|
4758
|
-
/* @__PURE__ */ (0,
|
|
4759
|
-
/* @__PURE__ */ (0,
|
|
4760
|
-
/* @__PURE__ */ (0,
|
|
4773
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Text, { style: [styles32.title, { color: tokens.text }], children: title }),
|
|
4774
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Text, { style: [styles32.msg, { color: tokens["text-2"] }], children: message }),
|
|
4775
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native40.View, { style: styles32.actions, children: [
|
|
4776
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Pressable, { onPress: onCancel, style: [styles32.btn, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Text, { style: { color: tokens["text-2"], fontWeight: "700", fontSize: 13.5 }, children: "Cancel" }) }),
|
|
4777
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Pressable, { onPress: onConfirm, style: [styles32.btn, { backgroundColor: tokens.danger }], children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native40.Text, { style: { color: "#ffffff", fontWeight: "700", fontSize: 13.5 }, children: confirmLabel }) })
|
|
4761
4778
|
] })
|
|
4762
4779
|
] }) }) });
|
|
4763
4780
|
}
|
|
4764
|
-
var
|
|
4781
|
+
var styles32 = import_react_native40.StyleSheet.create({
|
|
4765
4782
|
scrim: { flex: 1, backgroundColor: "rgba(0,0,0,0.5)", alignItems: "center", justifyContent: "center", padding: 32 },
|
|
4766
4783
|
card: { width: "100%", maxWidth: 340, borderWidth: 1, borderRadius: 16, padding: 18 },
|
|
4767
4784
|
title: { fontSize: 16, fontWeight: "800", marginBottom: 8 },
|
|
@@ -4771,21 +4788,21 @@ var styles31 = import_react_native39.StyleSheet.create({
|
|
|
4771
4788
|
});
|
|
4772
4789
|
|
|
4773
4790
|
// src/thread/AiRow.tsx
|
|
4774
|
-
var
|
|
4775
|
-
var
|
|
4791
|
+
var import_react26 = require("react");
|
|
4792
|
+
var import_react_native41 = require("react-native");
|
|
4776
4793
|
var Clipboard = __toESM(require("expo-clipboard"));
|
|
4777
|
-
var
|
|
4778
|
-
var AiRow = (0,
|
|
4794
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4795
|
+
var AiRow = (0, import_react26.forwardRef)(function AiRow2({ threadId, forumId, apiUrl, token }, ref) {
|
|
4779
4796
|
const { tokens } = useTheme();
|
|
4780
|
-
const [rowState, setRowState] = (0,
|
|
4781
|
-
const [summaryOpen, setSummaryOpen] = (0,
|
|
4782
|
-
const [summaryState, setSummaryState] = (0,
|
|
4783
|
-
const [summaryPoints, setSummaryPoints] = (0,
|
|
4784
|
-
const [suggestOpen, setSuggestOpen] = (0,
|
|
4785
|
-
const [suggestState, setSuggestState] = (0,
|
|
4786
|
-
const [suggestText, setSuggestText] = (0,
|
|
4787
|
-
const [suggestCopied, setSuggestCopied] = (0,
|
|
4788
|
-
(0,
|
|
4797
|
+
const [rowState, setRowState] = (0, import_react26.useState)("closed");
|
|
4798
|
+
const [summaryOpen, setSummaryOpen] = (0, import_react26.useState)(false);
|
|
4799
|
+
const [summaryState, setSummaryState] = (0, import_react26.useState)("idle");
|
|
4800
|
+
const [summaryPoints, setSummaryPoints] = (0, import_react26.useState)([]);
|
|
4801
|
+
const [suggestOpen, setSuggestOpen] = (0, import_react26.useState)(false);
|
|
4802
|
+
const [suggestState, setSuggestState] = (0, import_react26.useState)("idle");
|
|
4803
|
+
const [suggestText, setSuggestText] = (0, import_react26.useState)("");
|
|
4804
|
+
const [suggestCopied, setSuggestCopied] = (0, import_react26.useState)(false);
|
|
4805
|
+
(0, import_react26.useEffect)(() => {
|
|
4789
4806
|
setRowState("closed");
|
|
4790
4807
|
setSummaryOpen(false);
|
|
4791
4808
|
setSummaryState("idle");
|
|
@@ -4809,7 +4826,7 @@ var AiRow = (0, import_react25.forwardRef)(function AiRow2({ threadId, forumId,
|
|
|
4809
4826
|
setSuggestOpen(false);
|
|
4810
4827
|
}
|
|
4811
4828
|
};
|
|
4812
|
-
(0,
|
|
4829
|
+
(0, import_react26.useImperativeHandle)(ref, () => ({
|
|
4813
4830
|
openSummary: () => {
|
|
4814
4831
|
if (rowState === "open") return;
|
|
4815
4832
|
void openWithAvailability();
|
|
@@ -4866,63 +4883,63 @@ var AiRow = (0, import_react25.forwardRef)(function AiRow2({ threadId, forumId,
|
|
|
4866
4883
|
if (suggestState === "idle" || suggestState === "done") void fetchSuggest();
|
|
4867
4884
|
};
|
|
4868
4885
|
const panelOpen = summaryOpen || suggestOpen;
|
|
4869
|
-
return /* @__PURE__ */ (0,
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
4871
|
-
|
|
4886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { style: { marginBottom: 16 }, children: [
|
|
4887
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GradientBorderPill, { height: 36, borderWidth: 1.3, style: styles33.sparklePill, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4888
|
+
import_react_native41.Pressable,
|
|
4872
4889
|
{
|
|
4873
4890
|
onPress: handleSparkle,
|
|
4874
|
-
style:
|
|
4891
|
+
style: styles33.sparkleBtn,
|
|
4875
4892
|
disabled: rowState === "checking",
|
|
4876
4893
|
hitSlop: 4,
|
|
4877
4894
|
children: [
|
|
4878
|
-
rowState === "checking" ? /* @__PURE__ */ (0,
|
|
4879
|
-
/* @__PURE__ */ (0,
|
|
4895
|
+
rowState === "checking" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.ActivityIndicator, { size: "small", color: tokens.accent, style: { width: 16, height: 16 } }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SparkleIcon, { size: 16 }),
|
|
4896
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.sparkleLabel, { color: tokens.text }], children: "Ask AI" })
|
|
4880
4897
|
]
|
|
4881
4898
|
}
|
|
4882
4899
|
) }),
|
|
4883
|
-
rowState === "unavailable" && /* @__PURE__ */ (0,
|
|
4884
|
-
/* @__PURE__ */ (0,
|
|
4885
|
-
/* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
4900
|
+
rowState === "unavailable" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { style: [styles33.panel, { borderColor: tokens["border-strong"], backgroundColor: tokens["surface-2"] }], children: [
|
|
4901
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { style: styles33.panelHead, children: [
|
|
4902
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SparkleIcon, { size: 16 }),
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelTitle, { color: tokens.text }], children: "AI Features" }),
|
|
4904
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.View, { style: { flex: 1 } }),
|
|
4905
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Pressable, { onPress: () => setRowState("closed"), hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CloseIcon, { size: 16, color: tokens.muted }) })
|
|
4889
4906
|
] }),
|
|
4890
|
-
/* @__PURE__ */ (0,
|
|
4907
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelBody, { color: tokens.muted }], children: "AI features are not available for this deployment." })
|
|
4891
4908
|
] }),
|
|
4892
|
-
rowState === "open" && /* @__PURE__ */ (0,
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
4894
|
-
/* @__PURE__ */ (0,
|
|
4895
|
-
/* @__PURE__ */ (0,
|
|
4909
|
+
rowState === "open" && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
4910
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { style: [styles33.actionRow], children: [
|
|
4911
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AiButton, { label: "Summarise thread", onPress: toggleSummary, active: summaryOpen }),
|
|
4912
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AiButton, { label: "Suggest reply", onPress: toggleSuggest, active: suggestOpen })
|
|
4896
4913
|
] }),
|
|
4897
|
-
panelOpen && /* @__PURE__ */ (0,
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
4899
|
-
/* @__PURE__ */ (0,
|
|
4900
|
-
/* @__PURE__ */ (0,
|
|
4901
|
-
/* @__PURE__ */ (0,
|
|
4902
|
-
/* @__PURE__ */ (0,
|
|
4914
|
+
panelOpen && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { style: [styles33.panel, { borderColor: tokens["border-strong"], backgroundColor: tokens["surface-2"] }], children: [
|
|
4915
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { style: styles33.panelHead, children: [
|
|
4916
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SparkleIcon, { size: 16 }),
|
|
4917
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelTitle, { color: tokens.text }], children: summaryOpen ? "Thread summary" : "Suggested reply" }),
|
|
4918
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.View, { style: { flex: 1 } }),
|
|
4919
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Pressable, { onPress: () => {
|
|
4903
4920
|
setSummaryOpen(false);
|
|
4904
4921
|
setSuggestOpen(false);
|
|
4905
|
-
}, hitSlop: 8, children: /* @__PURE__ */ (0,
|
|
4922
|
+
}, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CloseIcon, { size: 16, color: tokens.muted }) })
|
|
4906
4923
|
] }),
|
|
4907
|
-
summaryOpen && (summaryState === "loading" ? /* @__PURE__ */ (0,
|
|
4908
|
-
/* @__PURE__ */ (0,
|
|
4909
|
-
/* @__PURE__ */ (0,
|
|
4924
|
+
summaryOpen && (summaryState === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelBody, { color: tokens.muted }], children: "Summarising\u2026" }) : summaryState === "error" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelBody, { color: tokens.muted }], children: "AI service unavailable" }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.View, { style: { gap: 6 }, children: summaryPoints.map((pt, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { style: styles33.bulletRow, children: [
|
|
4925
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.bullet, { color: tokens["text-2"] }], children: "\u2022" }),
|
|
4926
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelBody, { color: tokens["text-2"], flex: 1 }], children: pt })
|
|
4910
4927
|
] }, i)) })),
|
|
4911
|
-
suggestOpen && (suggestState === "error" ? /* @__PURE__ */ (0,
|
|
4912
|
-
/* @__PURE__ */ (0,
|
|
4913
|
-
suggestState === "done" && /* @__PURE__ */ (0,
|
|
4914
|
-
|
|
4928
|
+
suggestOpen && (suggestState === "error" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelBody, { color: tokens.muted }], children: "AI service unavailable" }) : suggestText ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native41.View, { children: [
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelBody, { color: tokens["text-2"] }], children: suggestText }),
|
|
4930
|
+
suggestState === "done" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4931
|
+
import_react_native41.Pressable,
|
|
4915
4932
|
{
|
|
4916
|
-
style: [
|
|
4933
|
+
style: [styles33.copyBtn, { borderColor: suggestCopied ? tokens.accent : tokens.border, backgroundColor: tokens.surface }],
|
|
4917
4934
|
onPress: () => {
|
|
4918
4935
|
void Clipboard.setStringAsync(suggestText);
|
|
4919
4936
|
setSuggestCopied(true);
|
|
4920
4937
|
setTimeout(() => setSuggestCopied(false), 1500);
|
|
4921
4938
|
},
|
|
4922
|
-
children: suggestCopied ? /* @__PURE__ */ (0,
|
|
4939
|
+
children: suggestCopied ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CheckIcon, { size: 15, color: tokens.accent }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CopyIcon, { size: 15, color: tokens["text-2"] })
|
|
4923
4940
|
}
|
|
4924
4941
|
)
|
|
4925
|
-
] }) : /* @__PURE__ */ (0,
|
|
4942
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.panelBody, { color: tokens.muted }], children: "Generating suggestion\u2026" }))
|
|
4926
4943
|
] })
|
|
4927
4944
|
] })
|
|
4928
4945
|
] });
|
|
@@ -4930,19 +4947,19 @@ var AiRow = (0, import_react25.forwardRef)(function AiRow2({ threadId, forumId,
|
|
|
4930
4947
|
var AiRow_default = AiRow;
|
|
4931
4948
|
function AiButton({ label, onPress, active }) {
|
|
4932
4949
|
const { tokens } = useTheme();
|
|
4933
|
-
return /* @__PURE__ */ (0,
|
|
4934
|
-
|
|
4950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GradientBorderPill, { height: 34, borderWidth: 1.3, filled: active, style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4951
|
+
import_react_native41.Pressable,
|
|
4935
4952
|
{
|
|
4936
4953
|
onPress,
|
|
4937
|
-
style:
|
|
4954
|
+
style: styles33.aiBtn,
|
|
4938
4955
|
children: [
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
4940
|
-
/* @__PURE__ */ (0,
|
|
4956
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SparkleIcon, { size: 14 }),
|
|
4957
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native41.Text, { style: [styles33.aiBtnLabel, { color: tokens.text }], children: label })
|
|
4941
4958
|
]
|
|
4942
4959
|
}
|
|
4943
4960
|
) });
|
|
4944
4961
|
}
|
|
4945
|
-
var
|
|
4962
|
+
var styles33 = import_react_native41.StyleSheet.create({
|
|
4946
4963
|
sparklePill: { alignSelf: "flex-start" },
|
|
4947
4964
|
sparkleBtn: { flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: 16 },
|
|
4948
4965
|
sparkleLabel: { fontSize: 13, fontWeight: "600" },
|
|
@@ -4973,9 +4990,9 @@ var styles32 = import_react_native40.StyleSheet.create({
|
|
|
4973
4990
|
});
|
|
4974
4991
|
|
|
4975
4992
|
// src/thread/CommentComposer.tsx
|
|
4976
|
-
var
|
|
4977
|
-
var
|
|
4978
|
-
var
|
|
4993
|
+
var import_react27 = require("react");
|
|
4994
|
+
var import_react_native42 = require("react-native");
|
|
4995
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4979
4996
|
function CommentComposer({
|
|
4980
4997
|
apiUrl,
|
|
4981
4998
|
forumId,
|
|
@@ -4986,10 +5003,10 @@ function CommentComposer({
|
|
|
4986
5003
|
submitLabel = "Comment"
|
|
4987
5004
|
}) {
|
|
4988
5005
|
const { tokens } = useTheme();
|
|
4989
|
-
const [body, setBody] = (0,
|
|
4990
|
-
const [attachments, setAttachments] = (0,
|
|
4991
|
-
const [submitting, setSubmitting] = (0,
|
|
4992
|
-
const [uploading, setUploading] = (0,
|
|
5006
|
+
const [body, setBody] = (0, import_react27.useState)("");
|
|
5007
|
+
const [attachments, setAttachments] = (0, import_react27.useState)([]);
|
|
5008
|
+
const [submitting, setSubmitting] = (0, import_react27.useState)(false);
|
|
5009
|
+
const [uploading, setUploading] = (0, import_react27.useState)(false);
|
|
4993
5010
|
const canSubmit = (body.trim().length > 0 || attachments.length > 0) && !submitting && !uploading;
|
|
4994
5011
|
async function submit() {
|
|
4995
5012
|
if (!canSubmit) return;
|
|
@@ -5002,8 +5019,8 @@ function CommentComposer({
|
|
|
5002
5019
|
setSubmitting(false);
|
|
5003
5020
|
}
|
|
5004
5021
|
}
|
|
5005
|
-
return /* @__PURE__ */ (0,
|
|
5006
|
-
/* @__PURE__ */ (0,
|
|
5022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native42.View, { style: { marginTop: 12 }, children: [
|
|
5023
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5007
5024
|
RichComposer,
|
|
5008
5025
|
{
|
|
5009
5026
|
apiUrl,
|
|
@@ -5018,35 +5035,35 @@ function CommentComposer({
|
|
|
5018
5035
|
minHeight: 64
|
|
5019
5036
|
}
|
|
5020
5037
|
),
|
|
5021
|
-
/* @__PURE__ */ (0,
|
|
5022
|
-
onCancel && /* @__PURE__ */ (0,
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5038
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native42.View, { style: styles34.actions, children: [
|
|
5039
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native42.Pressable, { onPress: onCancel, style: [styles34.btn, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native42.Text, { style: { color: tokens["text-2"], fontWeight: "700", fontSize: 13 }, children: "Cancel" }) }),
|
|
5040
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native42.Pressable, { onPress: submit, disabled: !canSubmit, style: [styles34.btn, { backgroundColor: tokens.accent, opacity: canSubmit ? 1 : 0.5 }], children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native42.Text, { style: { color: tokens["accent-fg"], fontWeight: "700", fontSize: 13 }, children: submitting ? "\u2026" : uploading ? "Uploading\u2026" : submitLabel }) })
|
|
5024
5041
|
] })
|
|
5025
5042
|
] });
|
|
5026
5043
|
}
|
|
5027
|
-
var
|
|
5044
|
+
var styles34 = import_react_native42.StyleSheet.create({
|
|
5028
5045
|
actions: { flexDirection: "row", justifyContent: "flex-end", gap: 8, marginTop: 8 },
|
|
5029
5046
|
btn: { borderRadius: 999, paddingVertical: 8, paddingHorizontal: 16 }
|
|
5030
5047
|
});
|
|
5031
5048
|
|
|
5032
5049
|
// src/thread/CommentRow.tsx
|
|
5033
|
-
var
|
|
5034
|
-
var
|
|
5035
|
-
var
|
|
5050
|
+
var import_react28 = require("react");
|
|
5051
|
+
var import_react_native43 = require("react-native");
|
|
5052
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5036
5053
|
function CommentRow({ node, depth = 0, ctx }) {
|
|
5037
5054
|
const { tokens } = useTheme();
|
|
5038
|
-
const [replyOpen, setReplyOpen] = (0,
|
|
5039
|
-
const [editOpen, setEditOpen] = (0,
|
|
5040
|
-
const [editBody, setEditBody] = (0,
|
|
5041
|
-
const [deleteOpen, setDeleteOpen] = (0,
|
|
5042
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
5055
|
+
const [replyOpen, setReplyOpen] = (0, import_react28.useState)(false);
|
|
5056
|
+
const [editOpen, setEditOpen] = (0, import_react28.useState)(false);
|
|
5057
|
+
const [editBody, setEditBody] = (0, import_react28.useState)(node.body);
|
|
5058
|
+
const [deleteOpen, setDeleteOpen] = (0, import_react28.useState)(false);
|
|
5059
|
+
const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
|
|
5043
5060
|
const { ref: ellipsisRef, anchor, measure } = useAnchor();
|
|
5044
5061
|
const canModify = ctx.currentUserId !== null && (node.authorId === ctx.currentUserId || ctx.isModerator);
|
|
5045
|
-
return /* @__PURE__ */ (0,
|
|
5046
|
-
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5063
|
+
import_react_native43.View,
|
|
5047
5064
|
{
|
|
5048
5065
|
style: [
|
|
5049
|
-
|
|
5066
|
+
styles35.row,
|
|
5050
5067
|
depth > 0 && { marginLeft: 16, borderLeftWidth: 1, borderLeftColor: tokens.border, paddingLeft: 10 },
|
|
5051
5068
|
// Wins over the depth>0 border above when both apply (a reply that's
|
|
5052
5069
|
// also the accepted answer) — the accepted-answer accent is the more
|
|
@@ -5060,28 +5077,28 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5060
5077
|
}
|
|
5061
5078
|
],
|
|
5062
5079
|
children: [
|
|
5063
|
-
/* @__PURE__ */ (0,
|
|
5064
|
-
|
|
5080
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5081
|
+
import_react_native43.Pressable,
|
|
5065
5082
|
{
|
|
5066
|
-
style:
|
|
5083
|
+
style: styles35.head,
|
|
5067
5084
|
onPress: ctx.onPressAuthor && node.authorId ? () => ctx.onPressAuthor(node.authorId) : void 0,
|
|
5068
5085
|
disabled: !ctx.onPressAuthor || !node.authorId,
|
|
5069
5086
|
children: [
|
|
5070
|
-
/* @__PURE__ */ (0,
|
|
5071
|
-
/* @__PURE__ */ (0,
|
|
5072
|
-
/* @__PURE__ */ (0,
|
|
5087
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Avatar, { authorId: node.authorId, author: node.author, avatarUrl: node.authorAvatarUrl, size: 24 }),
|
|
5088
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.Text, { style: [styles35.author, { color: tokens.text }], children: node.author }),
|
|
5089
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_native43.Text, { style: [styles35.time, { color: tokens.muted }], children: [
|
|
5073
5090
|
"\xB7 ",
|
|
5074
5091
|
node.time
|
|
5075
5092
|
] }),
|
|
5076
|
-
node.isAcceptedAnswer && /* @__PURE__ */ (0,
|
|
5077
|
-
/* @__PURE__ */ (0,
|
|
5078
|
-
/* @__PURE__ */ (0,
|
|
5093
|
+
node.isAcceptedAnswer && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_native43.View, { style: [styles35.answerBadge, { backgroundColor: tokens["success-soft-strong"] }], children: [
|
|
5094
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckIcon, { size: 11, color: tokens.success }),
|
|
5095
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.Text, { style: { color: tokens.success, fontSize: 11, fontWeight: "700" }, children: "Answer" })
|
|
5079
5096
|
] })
|
|
5080
5097
|
]
|
|
5081
5098
|
}
|
|
5082
5099
|
),
|
|
5083
|
-
editOpen ? /* @__PURE__ */ (0,
|
|
5084
|
-
/* @__PURE__ */ (0,
|
|
5100
|
+
editOpen ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_native43.View, { style: { marginTop: 8, marginLeft: 32 }, children: [
|
|
5101
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5085
5102
|
RichComposer,
|
|
5086
5103
|
{
|
|
5087
5104
|
apiUrl: ctx.apiUrl,
|
|
@@ -5095,44 +5112,44 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5095
5112
|
allowMedia: false
|
|
5096
5113
|
}
|
|
5097
5114
|
),
|
|
5098
|
-
/* @__PURE__ */ (0,
|
|
5099
|
-
/* @__PURE__ */ (0,
|
|
5115
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_native43.View, { style: styles35.editActions, children: [
|
|
5116
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.Pressable, { onPress: () => {
|
|
5100
5117
|
setEditOpen(false);
|
|
5101
5118
|
setEditBody(node.body);
|
|
5102
|
-
}, style: [
|
|
5103
|
-
/* @__PURE__ */ (0,
|
|
5104
|
-
|
|
5119
|
+
}, style: [styles35.smallBtn, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.Text, { style: { color: tokens["text-2"], fontWeight: "700", fontSize: 12 }, children: "Cancel" }) }),
|
|
5120
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5121
|
+
import_react_native43.Pressable,
|
|
5105
5122
|
{
|
|
5106
5123
|
onPress: async () => {
|
|
5107
5124
|
await ctx.onEdit(node.id, editBody.trim());
|
|
5108
5125
|
setEditOpen(false);
|
|
5109
5126
|
},
|
|
5110
|
-
style: [
|
|
5111
|
-
children: /* @__PURE__ */ (0,
|
|
5127
|
+
style: [styles35.smallBtn, { backgroundColor: tokens.accent }],
|
|
5128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.Text, { style: { color: tokens["accent-fg"], fontWeight: "700", fontSize: 12 }, children: "Save" })
|
|
5112
5129
|
}
|
|
5113
5130
|
)
|
|
5114
5131
|
] })
|
|
5115
|
-
] }) : /* @__PURE__ */ (0,
|
|
5116
|
-
/* @__PURE__ */ (0,
|
|
5117
|
-
/* @__PURE__ */ (0,
|
|
5118
|
-
/* @__PURE__ */ (0,
|
|
5119
|
-
/* @__PURE__ */ (0,
|
|
5120
|
-
/* @__PURE__ */ (0,
|
|
5121
|
-
|
|
5132
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.View, { style: styles35.body, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RenderedBody, { body: node.body, size: 13.5 }) }),
|
|
5133
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_native43.View, { style: styles35.actions, children: [
|
|
5134
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(VotePill, { voteCounts: node.voteCounts, dir: node.myVote ?? null, onVote: (dir) => ctx.onVote(node.id, dir) }),
|
|
5135
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Action, { label: "Reply", onPress: () => setReplyOpen((o) => !o) }),
|
|
5136
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Action, { label: node.isSaved ? "Unsave" : "Save", onPress: () => ctx.onSave(node.id, !node.isSaved) }),
|
|
5137
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5138
|
+
import_react_native43.Pressable,
|
|
5122
5139
|
{
|
|
5123
5140
|
ref: ellipsisRef,
|
|
5124
5141
|
onPress: () => measure(() => setMenuOpen(true)),
|
|
5125
5142
|
hitSlop: 6,
|
|
5126
|
-
style: [
|
|
5127
|
-
children: /* @__PURE__ */ (0,
|
|
5143
|
+
style: [styles35.ellipsisBtn, { backgroundColor: menuOpen ? tokens["hover-2"] : tokens["surface-2"] }],
|
|
5144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EllipsisIcon, { size: 17, color: tokens["text-2"] })
|
|
5128
5145
|
}
|
|
5129
5146
|
)
|
|
5130
5147
|
] }),
|
|
5131
|
-
/* @__PURE__ */ (0,
|
|
5132
|
-
canModify && /* @__PURE__ */ (0,
|
|
5148
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(DropdownMenu, { visible: menuOpen, onClose: () => setMenuOpen(false), anchor, width: 170, align: "right", children: [
|
|
5149
|
+
canModify && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5133
5150
|
DropdownMenuItem,
|
|
5134
5151
|
{
|
|
5135
|
-
icon: /* @__PURE__ */ (0,
|
|
5152
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PencilIcon, { size: 16, color: tokens["text-2"] }),
|
|
5136
5153
|
label: "Edit",
|
|
5137
5154
|
onPress: () => {
|
|
5138
5155
|
setMenuOpen(false);
|
|
@@ -5141,10 +5158,10 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5141
5158
|
}
|
|
5142
5159
|
}
|
|
5143
5160
|
),
|
|
5144
|
-
depth === 0 && ctx.canAcceptAnswer && /* @__PURE__ */ (0,
|
|
5161
|
+
depth === 0 && ctx.canAcceptAnswer && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5145
5162
|
DropdownMenuItem,
|
|
5146
5163
|
{
|
|
5147
|
-
icon: /* @__PURE__ */ (0,
|
|
5164
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckIcon, { size: 16, color: node.isAcceptedAnswer ? tokens.success : tokens["text-2"] }),
|
|
5148
5165
|
label: node.isAcceptedAnswer ? "Unaccept" : "Accept",
|
|
5149
5166
|
labelColor: node.isAcceptedAnswer ? tokens.success : void 0,
|
|
5150
5167
|
onPress: () => {
|
|
@@ -5153,10 +5170,10 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5153
5170
|
}
|
|
5154
5171
|
}
|
|
5155
5172
|
),
|
|
5156
|
-
depth === 0 && /* @__PURE__ */ (0,
|
|
5173
|
+
depth === 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5157
5174
|
DropdownMenuItem,
|
|
5158
5175
|
{
|
|
5159
|
-
icon: /* @__PURE__ */ (0,
|
|
5176
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ShareIcon, { size: 16, color: tokens["text-2"] }),
|
|
5160
5177
|
label: "Share",
|
|
5161
5178
|
onPress: () => {
|
|
5162
5179
|
setMenuOpen(false);
|
|
@@ -5164,10 +5181,10 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5164
5181
|
}
|
|
5165
5182
|
}
|
|
5166
5183
|
),
|
|
5167
|
-
/* @__PURE__ */ (0,
|
|
5184
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5168
5185
|
DropdownMenuItem,
|
|
5169
5186
|
{
|
|
5170
|
-
icon: /* @__PURE__ */ (0,
|
|
5187
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ReportIcon, { size: 16, color: tokens["text-2"] }),
|
|
5171
5188
|
label: "Report",
|
|
5172
5189
|
onPress: () => {
|
|
5173
5190
|
setMenuOpen(false);
|
|
@@ -5175,10 +5192,10 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5175
5192
|
}
|
|
5176
5193
|
}
|
|
5177
5194
|
),
|
|
5178
|
-
canModify && /* @__PURE__ */ (0,
|
|
5195
|
+
canModify && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5179
5196
|
DropdownMenuItem,
|
|
5180
5197
|
{
|
|
5181
|
-
icon: /* @__PURE__ */ (0,
|
|
5198
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TrashIcon, { size: 16, color: tokens["text-2"] }),
|
|
5182
5199
|
label: "Delete",
|
|
5183
5200
|
onPress: () => {
|
|
5184
5201
|
setMenuOpen(false);
|
|
@@ -5187,7 +5204,7 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5187
5204
|
}
|
|
5188
5205
|
)
|
|
5189
5206
|
] }),
|
|
5190
|
-
replyOpen && /* @__PURE__ */ (0,
|
|
5207
|
+
replyOpen && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.View, { style: { marginLeft: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5191
5208
|
CommentComposer,
|
|
5192
5209
|
{
|
|
5193
5210
|
apiUrl: ctx.apiUrl,
|
|
@@ -5202,8 +5219,8 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5202
5219
|
onCancel: () => setReplyOpen(false)
|
|
5203
5220
|
}
|
|
5204
5221
|
) }),
|
|
5205
|
-
node.replies.map((child) => /* @__PURE__ */ (0,
|
|
5206
|
-
deleteOpen && /* @__PURE__ */ (0,
|
|
5222
|
+
node.replies.map((child) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CommentRow, { node: child, depth: depth + 1, ctx }, child.id)),
|
|
5223
|
+
deleteOpen && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5207
5224
|
ConfirmDialog,
|
|
5208
5225
|
{
|
|
5209
5226
|
title: "Delete comment?",
|
|
@@ -5221,9 +5238,9 @@ function CommentRow({ node, depth = 0, ctx }) {
|
|
|
5221
5238
|
}
|
|
5222
5239
|
function Action({ label, onPress }) {
|
|
5223
5240
|
const { tokens } = useTheme();
|
|
5224
|
-
return /* @__PURE__ */ (0,
|
|
5241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.Pressable, { onPress, hitSlop: 6, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native43.Text, { style: { color: tokens.muted, fontSize: 12, fontWeight: "600" }, children: label }) });
|
|
5225
5242
|
}
|
|
5226
|
-
var
|
|
5243
|
+
var styles35 = import_react_native43.StyleSheet.create({
|
|
5227
5244
|
row: { marginTop: 14 },
|
|
5228
5245
|
head: { flexDirection: "row", alignItems: "center", gap: 7 },
|
|
5229
5246
|
author: { fontSize: 13, fontWeight: "700" },
|
|
@@ -5246,7 +5263,7 @@ var styles34 = import_react_native42.StyleSheet.create({
|
|
|
5246
5263
|
});
|
|
5247
5264
|
|
|
5248
5265
|
// src/screens/ThreadScreen.tsx
|
|
5249
|
-
var
|
|
5266
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5250
5267
|
var COMMENT_SORTS = ["Best", "Top", "Controversial", "Old"];
|
|
5251
5268
|
var COMMENT_SORT_ICON = {
|
|
5252
5269
|
Best: RocketIcon,
|
|
@@ -5281,31 +5298,31 @@ function ThreadScreen() {
|
|
|
5281
5298
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
5282
5299
|
const currentUserId = session.status === "ready" ? session.userId : null;
|
|
5283
5300
|
const isModerator = session.status === "ready" && (session.role === "moderator" || session.role === "admin");
|
|
5284
|
-
const [thread, setThread] = (0,
|
|
5285
|
-
const [comments, setComments] = (0,
|
|
5286
|
-
const [loading, setLoading] = (0,
|
|
5287
|
-
const [error, setError] = (0,
|
|
5288
|
-
const [commentSort, setCommentSort] = (0,
|
|
5289
|
-
const [search, setSearch] = (0,
|
|
5290
|
-
const [reportTarget, setReportTarget] = (0,
|
|
5291
|
-
const [shareTarget, setShareTarget] = (0,
|
|
5292
|
-
const [postEditOpen, setPostEditOpen] = (0,
|
|
5293
|
-
const [postEditTitle, setPostEditTitle] = (0,
|
|
5294
|
-
const [postEditBody, setPostEditBody] = (0,
|
|
5295
|
-
const [postDeleteOpen, setPostDeleteOpen] = (0,
|
|
5296
|
-
const [postMenuOpen, setPostMenuOpen] = (0,
|
|
5297
|
-
const [viewingUserId, setViewingUserId] = (0,
|
|
5298
|
-
const aiRowRef = (0,
|
|
5299
|
-
const scrollRef = (0,
|
|
5300
|
-
const scrollHandlerRef = (0,
|
|
5301
|
+
const [thread, setThread] = (0, import_react29.useState)(null);
|
|
5302
|
+
const [comments, setComments] = (0, import_react29.useState)([]);
|
|
5303
|
+
const [loading, setLoading] = (0, import_react29.useState)(true);
|
|
5304
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
5305
|
+
const [commentSort, setCommentSort] = (0, import_react29.useState)("Best");
|
|
5306
|
+
const [search, setSearch] = (0, import_react29.useState)("");
|
|
5307
|
+
const [reportTarget, setReportTarget] = (0, import_react29.useState)(null);
|
|
5308
|
+
const [shareTarget, setShareTarget] = (0, import_react29.useState)(null);
|
|
5309
|
+
const [postEditOpen, setPostEditOpen] = (0, import_react29.useState)(false);
|
|
5310
|
+
const [postEditTitle, setPostEditTitle] = (0, import_react29.useState)("");
|
|
5311
|
+
const [postEditBody, setPostEditBody] = (0, import_react29.useState)("");
|
|
5312
|
+
const [postDeleteOpen, setPostDeleteOpen] = (0, import_react29.useState)(false);
|
|
5313
|
+
const [postMenuOpen, setPostMenuOpen] = (0, import_react29.useState)(false);
|
|
5314
|
+
const [viewingUserId, setViewingUserId] = (0, import_react29.useState)(null);
|
|
5315
|
+
const aiRowRef = (0, import_react29.useRef)(null);
|
|
5316
|
+
const scrollRef = (0, import_react29.useRef)(null);
|
|
5317
|
+
const scrollHandlerRef = (0, import_react29.useRef)(() => {
|
|
5301
5318
|
});
|
|
5302
5319
|
const { ref: postMenuRef, anchor: postMenuAnchor, measure: measurePostMenu } = useAnchor();
|
|
5303
|
-
const translateX = (0,
|
|
5304
|
-
const screenWidth =
|
|
5305
|
-
const swipeRef = (0,
|
|
5320
|
+
const translateX = (0, import_react29.useRef)(new import_react_native44.Animated.Value(0)).current;
|
|
5321
|
+
const screenWidth = import_react_native44.Dimensions.get("window").width;
|
|
5322
|
+
const swipeRef = (0, import_react29.useRef)({ nextId: nextId2, prevId, threadIds, startX: 0 });
|
|
5306
5323
|
swipeRef.current = { ...swipeRef.current, nextId: nextId2, prevId, threadIds };
|
|
5307
|
-
const panResponder = (0,
|
|
5308
|
-
|
|
5324
|
+
const panResponder = (0, import_react29.useRef)(
|
|
5325
|
+
import_react_native44.PanResponder.create({
|
|
5309
5326
|
onStartShouldSetPanResponder: (e) => {
|
|
5310
5327
|
swipeRef.current.startX = e.nativeEvent.pageX;
|
|
5311
5328
|
return false;
|
|
@@ -5321,23 +5338,23 @@ function ThreadScreen() {
|
|
|
5321
5338
|
const SWIPE_THRESHOLD = 80;
|
|
5322
5339
|
const { nextId: n, prevId: p, threadIds: ids } = swipeRef.current;
|
|
5323
5340
|
if (gesture.dx <= -SWIPE_THRESHOLD && n) {
|
|
5324
|
-
|
|
5341
|
+
import_react_native44.Animated.timing(translateX, { toValue: -screenWidth, duration: 200, easing: import_react_native44.Easing.out(import_react_native44.Easing.cubic), useNativeDriver: false }).start(() => {
|
|
5325
5342
|
navigation.replace("Thread", { threadId: n, threadIds: ids });
|
|
5326
5343
|
});
|
|
5327
5344
|
} else if (gesture.dx >= SWIPE_THRESHOLD && p) {
|
|
5328
|
-
|
|
5345
|
+
import_react_native44.Animated.timing(translateX, { toValue: screenWidth, duration: 200, easing: import_react_native44.Easing.out(import_react_native44.Easing.cubic), useNativeDriver: false }).start(() => {
|
|
5329
5346
|
navigation.replace("Thread", { threadId: p, threadIds: ids });
|
|
5330
5347
|
});
|
|
5331
5348
|
} else {
|
|
5332
|
-
|
|
5349
|
+
import_react_native44.Animated.spring(translateX, { toValue: 0, useNativeDriver: false, bounciness: 6 }).start();
|
|
5333
5350
|
}
|
|
5334
5351
|
},
|
|
5335
5352
|
onPanResponderTerminate: () => {
|
|
5336
|
-
|
|
5353
|
+
import_react_native44.Animated.spring(translateX, { toValue: 0, useNativeDriver: false, bounciness: 6 }).start();
|
|
5337
5354
|
}
|
|
5338
5355
|
})
|
|
5339
5356
|
).current;
|
|
5340
|
-
(0,
|
|
5357
|
+
(0, import_react29.useEffect)(() => {
|
|
5341
5358
|
if (!token) return;
|
|
5342
5359
|
let cancelled = false;
|
|
5343
5360
|
setLoading(true);
|
|
@@ -5356,7 +5373,7 @@ function ThreadScreen() {
|
|
|
5356
5373
|
cancelled = true;
|
|
5357
5374
|
};
|
|
5358
5375
|
}, [apiUrl, forumId, threadId, token]);
|
|
5359
|
-
const tree = (0,
|
|
5376
|
+
const tree = (0, import_react29.useMemo)(() => {
|
|
5360
5377
|
const built = commentsToCommentTree(comments);
|
|
5361
5378
|
const filtered = search.trim() ? filterComments(built, search.trim()) : built;
|
|
5362
5379
|
return sortRoots(filtered, commentSort);
|
|
@@ -5459,37 +5476,37 @@ function ThreadScreen() {
|
|
|
5459
5476
|
});
|
|
5460
5477
|
}
|
|
5461
5478
|
const media = thread?.attachments ?? [];
|
|
5462
|
-
return /* @__PURE__ */ (0,
|
|
5463
|
-
loading ? /* @__PURE__ */ (0,
|
|
5464
|
-
|
|
5479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Shell, { children: [
|
|
5480
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: styles36.center, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Mascot, { size: 36 }) }) : error && !thread ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: styles36.center, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: { color: tokens["text-2"] }, children: error }) }) : thread ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Animated.View, { style: { flex: 1, transform: [{ translateX }] }, ...panResponder.panHandlers, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.KeyboardAvoidingView, { style: { flex: 1 }, behavior: import_react_native44.Platform.OS === "ios" ? "padding" : "height", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5481
|
+
import_react_native44.ScrollView,
|
|
5465
5482
|
{
|
|
5466
5483
|
ref: scrollRef,
|
|
5467
|
-
contentContainerStyle:
|
|
5484
|
+
contentContainerStyle: styles36.content,
|
|
5468
5485
|
keyboardShouldPersistTaps: "handled",
|
|
5469
5486
|
onScroll: (e) => scrollHandlerRef.current(e),
|
|
5470
5487
|
scrollEventThrottle: 16,
|
|
5471
5488
|
children: [
|
|
5472
|
-
/* @__PURE__ */ (0,
|
|
5473
|
-
/* @__PURE__ */ (0,
|
|
5474
|
-
|
|
5489
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BackRow, { onPress: () => navigation.goBack() }),
|
|
5490
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5491
|
+
import_react_native44.Pressable,
|
|
5475
5492
|
{
|
|
5476
|
-
style:
|
|
5493
|
+
style: styles36.head,
|
|
5477
5494
|
onPress: () => {
|
|
5478
5495
|
if (thread.authorId !== currentUserId) setViewingUserId(thread.authorId);
|
|
5479
5496
|
},
|
|
5480
5497
|
children: [
|
|
5481
|
-
/* @__PURE__ */ (0,
|
|
5482
|
-
/* @__PURE__ */ (0,
|
|
5483
|
-
/* @__PURE__ */ (0,
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Avatar, { authorId: thread.authorId, author: thread.authorDisplayName ?? "Member", avatarUrl: thread.authorAvatarUrl, size: 26 }),
|
|
5499
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles36.author, { color: tokens.text }], children: thread.authorDisplayName ?? "Member" }),
|
|
5500
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.Text, { style: [styles36.time, { color: tokens.muted }], children: [
|
|
5484
5501
|
"\xB7 ",
|
|
5485
5502
|
fmtRelativeTime(thread.createdAt)
|
|
5486
5503
|
] })
|
|
5487
5504
|
]
|
|
5488
5505
|
}
|
|
5489
5506
|
),
|
|
5490
|
-
postEditOpen ? /* @__PURE__ */ (0,
|
|
5491
|
-
/* @__PURE__ */ (0,
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5507
|
+
postEditOpen ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: { marginBottom: 12 }, children: [
|
|
5508
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.TextInput, { value: postEditTitle, onChangeText: setPostEditTitle, style: [styles36.editInput, { color: tokens.text, borderColor: tokens["border-strong"], fontWeight: "700", marginBottom: 12 }] }),
|
|
5509
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5493
5510
|
RichComposer,
|
|
5494
5511
|
{
|
|
5495
5512
|
apiUrl,
|
|
@@ -5503,36 +5520,36 @@ function ThreadScreen() {
|
|
|
5503
5520
|
allowMedia: false
|
|
5504
5521
|
}
|
|
5505
5522
|
),
|
|
5506
|
-
/* @__PURE__ */ (0,
|
|
5507
|
-
/* @__PURE__ */ (0,
|
|
5508
|
-
/* @__PURE__ */ (0,
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: styles36.editActions, children: [
|
|
5524
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Pressable, { onPress: () => setPostEditOpen(false), style: [styles36.smallBtn, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: { color: tokens["text-2"], fontWeight: "700", fontSize: 13 }, children: "Cancel" }) }),
|
|
5525
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Pressable, { onPress: savePostEdit, style: [styles36.smallBtn, { backgroundColor: tokens.accent }], children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: { color: tokens["accent-fg"], fontWeight: "700", fontSize: 13 }, children: "Save" }) })
|
|
5509
5526
|
] })
|
|
5510
|
-
] }) : /* @__PURE__ */ (0,
|
|
5511
|
-
/* @__PURE__ */ (0,
|
|
5512
|
-
thread.body.trim().length > 0 && /* @__PURE__ */ (0,
|
|
5513
|
-
/* @__PURE__ */ (0,
|
|
5527
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
5528
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles36.title, { color: tokens.text }], children: thread.title }),
|
|
5529
|
+
thread.body.trim().length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: { marginBottom: 16 }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RenderedBody, { body: thread.body, size: 14.5 }) }),
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(MediaGallery, { attachments: media, aspectRatio: 4 / 5, radius: 14 })
|
|
5514
5531
|
] }),
|
|
5515
|
-
/* @__PURE__ */ (0,
|
|
5516
|
-
/* @__PURE__ */ (0,
|
|
5517
|
-
/* @__PURE__ */ (0,
|
|
5518
|
-
/* @__PURE__ */ (0,
|
|
5519
|
-
/* @__PURE__ */ (0,
|
|
5520
|
-
/* @__PURE__ */ (0,
|
|
5521
|
-
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: styles36.actions, children: [
|
|
5533
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(VotePill, { voteCounts: thread.voteCounts ?? { up: 0, down: 0 }, dir: thread.myVote ?? null, onVote: votePost }),
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CommentPill, { count: thread.commentCount ?? comments.length }),
|
|
5535
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: { flex: 1 } }),
|
|
5536
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PostAction, { label: "Share", onPress: () => setShareTarget({ kind: "post", id: threadId }) }),
|
|
5537
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5538
|
+
import_react_native44.Pressable,
|
|
5522
5539
|
{
|
|
5523
5540
|
ref: postMenuRef,
|
|
5524
5541
|
onPress: () => measurePostMenu(() => setPostMenuOpen(true)),
|
|
5525
5542
|
hitSlop: 6,
|
|
5526
|
-
style: [
|
|
5527
|
-
children: /* @__PURE__ */ (0,
|
|
5543
|
+
style: [styles36.ellipsisBtn, { backgroundColor: postMenuOpen ? tokens["hover-2"] : tokens["surface-2"] }],
|
|
5544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EllipsisIcon, { size: 17, color: tokens["text-2"] })
|
|
5528
5545
|
}
|
|
5529
5546
|
)
|
|
5530
5547
|
] }),
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5548
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(DropdownMenu, { visible: postMenuOpen, onClose: () => setPostMenuOpen(false), anchor: postMenuAnchor, width: 150, align: "right", children: [
|
|
5549
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5533
5550
|
DropdownMenuItem,
|
|
5534
5551
|
{
|
|
5535
|
-
icon: /* @__PURE__ */ (0,
|
|
5552
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SaveIcon, { size: 16, color: tokens["text-2"], filled: !!thread.isSaved }),
|
|
5536
5553
|
label: thread.isSaved ? "Unsave" : "Save",
|
|
5537
5554
|
onPress: () => {
|
|
5538
5555
|
setPostMenuOpen(false);
|
|
@@ -5540,10 +5557,10 @@ function ThreadScreen() {
|
|
|
5540
5557
|
}
|
|
5541
5558
|
}
|
|
5542
5559
|
),
|
|
5543
|
-
canModifyPost && !postEditOpen && /* @__PURE__ */ (0,
|
|
5560
|
+
canModifyPost && !postEditOpen && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5544
5561
|
DropdownMenuItem,
|
|
5545
5562
|
{
|
|
5546
|
-
icon: /* @__PURE__ */ (0,
|
|
5563
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PencilIcon, { size: 16, color: tokens["text-2"] }),
|
|
5547
5564
|
label: "Edit",
|
|
5548
5565
|
onPress: () => {
|
|
5549
5566
|
setPostMenuOpen(false);
|
|
@@ -5553,10 +5570,10 @@ function ThreadScreen() {
|
|
|
5553
5570
|
}
|
|
5554
5571
|
}
|
|
5555
5572
|
),
|
|
5556
|
-
/* @__PURE__ */ (0,
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5557
5574
|
DropdownMenuItem,
|
|
5558
5575
|
{
|
|
5559
|
-
icon: /* @__PURE__ */ (0,
|
|
5576
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ReportIcon, { size: 16, color: tokens["text-2"] }),
|
|
5560
5577
|
label: "Report",
|
|
5561
5578
|
onPress: () => {
|
|
5562
5579
|
setPostMenuOpen(false);
|
|
@@ -5564,10 +5581,10 @@ function ThreadScreen() {
|
|
|
5564
5581
|
}
|
|
5565
5582
|
}
|
|
5566
5583
|
),
|
|
5567
|
-
canModifyPost && /* @__PURE__ */ (0,
|
|
5584
|
+
canModifyPost && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5568
5585
|
DropdownMenuItem,
|
|
5569
5586
|
{
|
|
5570
|
-
icon: /* @__PURE__ */ (0,
|
|
5587
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TrashIcon, { size: 16, color: tokens["text-2"] }),
|
|
5571
5588
|
label: "Delete",
|
|
5572
5589
|
onPress: () => {
|
|
5573
5590
|
setPostMenuOpen(false);
|
|
@@ -5576,12 +5593,12 @@ function ThreadScreen() {
|
|
|
5576
5593
|
}
|
|
5577
5594
|
)
|
|
5578
5595
|
] }),
|
|
5579
|
-
/* @__PURE__ */ (0,
|
|
5580
|
-
/* @__PURE__ */ (0,
|
|
5581
|
-
/* @__PURE__ */ (0,
|
|
5582
|
-
/* @__PURE__ */ (0,
|
|
5583
|
-
/* @__PURE__ */ (0,
|
|
5584
|
-
/* @__PURE__ */ (0,
|
|
5596
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AiRow_default, { ref: aiRowRef, threadId, forumId, apiUrl, token }),
|
|
5597
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AskAiRegistration, { aiRowRef }),
|
|
5598
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ScrollCollapseRegistration, { handlerRef: scrollHandlerRef }),
|
|
5599
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CommentComposer, { apiUrl, forumId, token, onSubmit: submitTopLevel }),
|
|
5600
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: styles36.sortRow, children: [
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5585
5602
|
SelectPill,
|
|
5586
5603
|
{
|
|
5587
5604
|
value: commentSort,
|
|
@@ -5591,22 +5608,22 @@ function ThreadScreen() {
|
|
|
5591
5608
|
menuWidth: 160,
|
|
5592
5609
|
optionIcon: (s) => {
|
|
5593
5610
|
const Icon = COMMENT_SORT_ICON[s];
|
|
5594
|
-
return /* @__PURE__ */ (0,
|
|
5611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { size: 16, color: tokens["text-2"] });
|
|
5595
5612
|
}
|
|
5596
5613
|
}
|
|
5597
5614
|
),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
/* @__PURE__ */ (0,
|
|
5600
|
-
/* @__PURE__ */ (0,
|
|
5615
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: [styles36.searchPill, { borderColor: tokens["border-strong"] }], children: [
|
|
5616
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SearchIcon, { size: 15, color: tokens.muted }),
|
|
5617
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.TextInput, { value: search, onChangeText: setSearch, placeholder: "Search Comments", placeholderTextColor: tokens.muted, style: { flex: 1, color: tokens.text, fontSize: 13, padding: 0 } })
|
|
5601
5618
|
] })
|
|
5602
5619
|
] }),
|
|
5603
|
-
tree.map((node) => /* @__PURE__ */ (0,
|
|
5620
|
+
tree.map((node) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CommentRow, { node, ctx }, node.id))
|
|
5604
5621
|
]
|
|
5605
5622
|
}
|
|
5606
5623
|
) }) }) : null,
|
|
5607
|
-
reportTarget && /* @__PURE__ */ (0,
|
|
5608
|
-
shareTarget && /* @__PURE__ */ (0,
|
|
5609
|
-
postDeleteOpen && /* @__PURE__ */ (0,
|
|
5624
|
+
reportTarget && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ReportSheet, { target: reportTarget.kind, onClose: () => setReportTarget(null), onSubmit: submitReport }),
|
|
5625
|
+
shareTarget && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ShareSheet, { apiUrl, forumId, token, onClose: () => setShareTarget(null), onShare: submitShare }),
|
|
5626
|
+
postDeleteOpen && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5610
5627
|
ConfirmDialog,
|
|
5611
5628
|
{
|
|
5612
5629
|
title: "Delete post?",
|
|
@@ -5619,12 +5636,12 @@ function ThreadScreen() {
|
|
|
5619
5636
|
}
|
|
5620
5637
|
}
|
|
5621
5638
|
),
|
|
5622
|
-
viewingUserId && /* @__PURE__ */ (0,
|
|
5639
|
+
viewingUserId && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(UserProfileSheet, { userId: viewingUserId, onClose: () => setViewingUserId(null) })
|
|
5623
5640
|
] });
|
|
5624
5641
|
}
|
|
5625
5642
|
function AskAiRegistration({ aiRowRef }) {
|
|
5626
5643
|
const { registerAskHandler } = useShell();
|
|
5627
|
-
(0,
|
|
5644
|
+
(0, import_react29.useEffect)(() => {
|
|
5628
5645
|
registerAskHandler(() => aiRowRef.current?.openSummary());
|
|
5629
5646
|
return () => registerAskHandler(null);
|
|
5630
5647
|
}, [registerAskHandler, aiRowRef]);
|
|
@@ -5636,9 +5653,9 @@ function ScrollCollapseRegistration({ handlerRef }) {
|
|
|
5636
5653
|
}
|
|
5637
5654
|
function PostAction({ label, onPress }) {
|
|
5638
5655
|
const { tokens } = useTheme();
|
|
5639
|
-
return /* @__PURE__ */ (0,
|
|
5656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Pressable, { onPress, hitSlop: 6, style: [styles36.postActionChip, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: { color: tokens["text-2"], fontSize: 13, fontWeight: "700" }, children: label }) });
|
|
5640
5657
|
}
|
|
5641
|
-
var
|
|
5658
|
+
var styles36 = import_react_native44.StyleSheet.create({
|
|
5642
5659
|
center: { flex: 1, alignItems: "center", justifyContent: "center", paddingVertical: 40 },
|
|
5643
5660
|
content: { paddingHorizontal: 16, paddingTop: 12, paddingBottom: 110 },
|
|
5644
5661
|
head: { flexDirection: "row", alignItems: "center", gap: 7, marginTop: 12, marginBottom: 8 },
|
|
@@ -5656,28 +5673,28 @@ var styles35 = import_react_native43.StyleSheet.create({
|
|
|
5656
5673
|
});
|
|
5657
5674
|
|
|
5658
5675
|
// src/screens/ProfileScreen.tsx
|
|
5659
|
-
var
|
|
5660
|
-
var
|
|
5676
|
+
var import_react31 = require("react");
|
|
5677
|
+
var import_react_native46 = require("react-native");
|
|
5661
5678
|
var import_native6 = require("@react-navigation/native");
|
|
5662
5679
|
|
|
5663
5680
|
// src/profile/EditProfileSheet.tsx
|
|
5664
|
-
var
|
|
5665
|
-
var
|
|
5666
|
-
var
|
|
5681
|
+
var import_react30 = require("react");
|
|
5682
|
+
var import_react_native45 = require("react-native");
|
|
5683
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5667
5684
|
var nextId = 0;
|
|
5668
5685
|
function EditProfileSheet({ apiUrl, forumId, token, profile, onClose, onSaved }) {
|
|
5669
5686
|
const { tokens, mode, toggleTheme } = useTheme();
|
|
5670
|
-
const { height: windowHeight } = (0,
|
|
5687
|
+
const { height: windowHeight } = (0, import_react_native45.useWindowDimensions)();
|
|
5671
5688
|
const { maxHeight: sheetMaxHeight, paddingBottom } = useSheetLayout(24);
|
|
5672
5689
|
const scrollMaxHeight = Math.min(300, windowHeight * 0.34);
|
|
5673
|
-
const [name, setName] = (0,
|
|
5674
|
-
const [bio, setBio] = (0,
|
|
5675
|
-
const [links, setLinks] = (0,
|
|
5690
|
+
const [name, setName] = (0, import_react30.useState)(profile.displayName);
|
|
5691
|
+
const [bio, setBio] = (0, import_react30.useState)(profile.bio ?? "");
|
|
5692
|
+
const [links, setLinks] = (0, import_react30.useState)(
|
|
5676
5693
|
profile.socialLinks.map((l) => ({ id: nextId++, platform: l.platform, suffix: socialToSuffix(l.platform, l.url) }))
|
|
5677
5694
|
);
|
|
5678
|
-
const [saving, setSaving] = (0,
|
|
5679
|
-
const [error, setError] = (0,
|
|
5680
|
-
const [openPickerId, setOpenPickerId] = (0,
|
|
5695
|
+
const [saving, setSaving] = (0, import_react30.useState)(false);
|
|
5696
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
5697
|
+
const [openPickerId, setOpenPickerId] = (0, import_react30.useState)(null);
|
|
5681
5698
|
function selectPlatform(id, platform) {
|
|
5682
5699
|
setLinks((prev) => prev.map((l) => l.id === id ? { ...l, platform, suffix: "" } : l));
|
|
5683
5700
|
setOpenPickerId(null);
|
|
@@ -5697,94 +5714,85 @@ function EditProfileSheet({ apiUrl, forumId, token, profile, onClose, onSaved })
|
|
|
5697
5714
|
setSaving(false);
|
|
5698
5715
|
}
|
|
5699
5716
|
}
|
|
5700
|
-
return /* @__PURE__ */ (0,
|
|
5701
|
-
/* @__PURE__ */ (0,
|
|
5702
|
-
|
|
5703
|
-
/* @__PURE__ */ (0,
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
{
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(BottomSheetShell, { visible: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.KeyboardAvoidingView, { style: { flex: 1, justifyContent: "flex-end" }, behavior: import_react_native45.Platform.OS === "ios" ? "padding" : "height", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native45.View, { style: [styles37.sheet, { backgroundColor: tokens.elev, borderColor: tokens.border, maxHeight: sheetMaxHeight, paddingBottom }], children: [
|
|
5718
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native45.View, { style: styles37.header, children: [
|
|
5719
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: [styles37.title, { color: tokens.text }], children: "Edit profile" }),
|
|
5720
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Pressable, { onPress: onClose, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CloseIcon, { size: 18, color: tokens.text }) })
|
|
5721
|
+
] }),
|
|
5722
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5723
|
+
import_react_native45.ScrollView,
|
|
5724
|
+
{
|
|
5725
|
+
style: { maxHeight: scrollMaxHeight, marginRight: -16 },
|
|
5726
|
+
contentContainerStyle: { paddingRight: 26 },
|
|
5727
|
+
keyboardShouldPersistTaps: "handled",
|
|
5728
|
+
children: [
|
|
5729
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: [styles37.label, { color: tokens["text-2"] }], children: "Display name" }),
|
|
5730
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.TextInput, { value: name, onChangeText: setName, style: [styles37.input, { color: tokens.text, borderColor: tokens["border-strong"] }] }),
|
|
5731
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: [styles37.label, { color: tokens["text-2"] }], children: "Bio" }),
|
|
5732
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.TextInput, { value: bio, onChangeText: setBio, multiline: true, style: [styles37.input, { color: tokens.text, borderColor: tokens["border-strong"], minHeight: 70, textAlignVertical: "top" }] }),
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: [styles37.label, { color: tokens["text-2"] }], children: "Links" }),
|
|
5734
|
+
links.map((link) => {
|
|
5735
|
+
const PlatformIcon = SOCIAL_PLATFORM_ICON[link.platform] ?? LinkIcon;
|
|
5736
|
+
const prefix = socialPrefix(link.platform).replace("https://", "");
|
|
5737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native45.View, { style: { marginBottom: 8 }, children: [
|
|
5738
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native45.View, { style: styles37.linkRow, children: [
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5740
|
+
import_react_native45.Pressable,
|
|
5741
|
+
{
|
|
5742
|
+
onPress: () => setOpenPickerId((id) => id === link.id ? null : link.id),
|
|
5743
|
+
style: [styles37.platBtn, { backgroundColor: tokens["surface-2"] }],
|
|
5744
|
+
children: [
|
|
5745
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PlatformIcon, { size: 17, color: tokens.text }),
|
|
5746
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDownIcon, { size: 11, color: tokens.muted })
|
|
5747
|
+
]
|
|
5748
|
+
}
|
|
5749
|
+
),
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native45.View, { style: [styles37.linkUrlWrap, { borderColor: tokens["border-strong"] }], children: [
|
|
5751
|
+
prefix.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: { color: tokens.muted, fontSize: 12.5 }, children: prefix }),
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5753
|
+
import_react_native45.TextInput,
|
|
5726
5754
|
{
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5755
|
+
value: link.suffix,
|
|
5756
|
+
onChangeText: (v) => setLinks((prev) => prev.map((l) => l.id === link.id ? { ...l, suffix: v } : l)),
|
|
5757
|
+
placeholder: socialPlaceholder(link.platform),
|
|
5758
|
+
placeholderTextColor: tokens.muted,
|
|
5759
|
+
autoCapitalize: "none",
|
|
5760
|
+
style: { flex: 1, color: tokens.text, fontSize: 13, padding: 0 }
|
|
5733
5761
|
}
|
|
5734
|
-
)
|
|
5735
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: [styles36.linkUrlWrap, { borderColor: tokens["border-strong"] }], children: [
|
|
5736
|
-
prefix.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: { color: tokens.muted, fontSize: 12.5 }, children: prefix }),
|
|
5737
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5738
|
-
import_react_native44.TextInput,
|
|
5739
|
-
{
|
|
5740
|
-
value: link.suffix,
|
|
5741
|
-
onChangeText: (v) => setLinks((prev) => prev.map((l) => l.id === link.id ? { ...l, suffix: v } : l)),
|
|
5742
|
-
placeholder: socialPlaceholder(link.platform),
|
|
5743
|
-
placeholderTextColor: tokens.muted,
|
|
5744
|
-
autoCapitalize: "none",
|
|
5745
|
-
style: { flex: 1, color: tokens.text, fontSize: 13, padding: 0 }
|
|
5746
|
-
}
|
|
5747
|
-
)
|
|
5748
|
-
] }),
|
|
5749
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Pressable, { onPress: () => setLinks((prev) => prev.filter((l) => l.id !== link.id)), hitSlop: 6, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CloseIcon, { size: 16, color: tokens.muted }) })
|
|
5762
|
+
)
|
|
5750
5763
|
] }),
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
},
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
] })
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
]
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5764
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Pressable, { onPress: () => setLinks((prev) => prev.filter((l) => l.id !== link.id)), hitSlop: 6, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CloseIcon, { size: 16, color: tokens.muted }) })
|
|
5765
|
+
] }),
|
|
5766
|
+
openPickerId === link.id && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.View, { style: [styles37.platformGrid, { backgroundColor: tokens["surface-2"], borderColor: tokens["border-strong"] }], children: SOCIAL_PLATFORMS.map((p) => {
|
|
5767
|
+
const OptIcon = SOCIAL_PLATFORM_ICON[p] ?? LinkIcon;
|
|
5768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5769
|
+
import_react_native45.Pressable,
|
|
5770
|
+
{
|
|
5771
|
+
onPress: () => selectPlatform(link.id, p),
|
|
5772
|
+
style: [styles37.platformOption, link.platform === p && { backgroundColor: tokens["hover-2"] }],
|
|
5773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(OptIcon, { size: 18, color: tokens.text })
|
|
5774
|
+
},
|
|
5775
|
+
p
|
|
5776
|
+
);
|
|
5777
|
+
}) })
|
|
5778
|
+
] }, link.id);
|
|
5779
|
+
}),
|
|
5780
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Pressable, { onPress: () => setLinks((prev) => [...prev, { id: nextId++, platform: "Website", suffix: "" }]), style: styles37.addLink, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: { color: tokens.accent, fontSize: 13, fontWeight: "600" }, children: "+ Add link" }) }),
|
|
5781
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native45.Pressable, { onPress: toggleTheme, style: [styles37.themeRow, { borderColor: tokens.border }], children: [
|
|
5782
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: { color: tokens.text, fontSize: 14 }, children: "Display mode" }),
|
|
5783
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native45.View, { style: { flexDirection: "row", alignItems: "center", gap: 6 }, children: [
|
|
5784
|
+
mode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(MoonIcon, { size: 16, color: tokens["text-2"] }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SunIcon, { size: 16, color: tokens["text-2"] }),
|
|
5785
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: { color: tokens["text-2"], fontSize: 13 }, children: mode === "dark" ? "Dark" : "Light" })
|
|
5786
|
+
] })
|
|
5787
|
+
] }),
|
|
5788
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: { color: tokens.up, fontSize: 13, marginTop: 8 }, children: error })
|
|
5789
|
+
]
|
|
5790
|
+
}
|
|
5791
|
+
),
|
|
5792
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Pressable, { onPress: save, disabled: saving, style: [styles37.saveBtn, { backgroundColor: tokens.accent, opacity: saving ? 0.5 : 1 }], children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native45.Text, { style: { color: tokens["accent-fg"], fontWeight: "700", fontSize: 14 }, children: saving ? "Saving\u2026" : "Save" }) })
|
|
5793
|
+
] }) }) });
|
|
5780
5794
|
}
|
|
5781
|
-
var
|
|
5782
|
-
// Full-screen dim backdrop, a sibling of sheetWrap below rather than its
|
|
5783
|
-
// parent — see the comment above where it's rendered.
|
|
5784
|
-
scrim: { ...import_react_native44.StyleSheet.absoluteFill, backgroundColor: "rgba(0,0,0,0.5)" },
|
|
5785
|
-
// Positions the sheet at the bottom; box-none means it never itself
|
|
5786
|
-
// intercepts a touch, so a tap above the sheet reaches the scrim behind it.
|
|
5787
|
-
sheetWrap: { flex: 1, justifyContent: "flex-end" },
|
|
5795
|
+
var styles37 = import_react_native45.StyleSheet.create({
|
|
5788
5796
|
sheet: { borderTopWidth: 1, borderTopLeftRadius: 18, borderTopRightRadius: 18, paddingHorizontal: 16, paddingTop: 16, overflow: "hidden" },
|
|
5789
5797
|
header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: 12 },
|
|
5790
5798
|
title: { fontSize: 16, fontWeight: "800" },
|
|
@@ -5801,7 +5809,7 @@ var styles36 = import_react_native44.StyleSheet.create({
|
|
|
5801
5809
|
});
|
|
5802
5810
|
|
|
5803
5811
|
// src/screens/ProfileScreen.tsx
|
|
5804
|
-
var
|
|
5812
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5805
5813
|
function ProfileBody() {
|
|
5806
5814
|
const { tokens } = useTheme();
|
|
5807
5815
|
const session = useSession();
|
|
@@ -5809,17 +5817,17 @@ function ProfileBody() {
|
|
|
5809
5817
|
const { openComposer } = useShell();
|
|
5810
5818
|
const { apiUrl, forumId } = session;
|
|
5811
5819
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
5812
|
-
const [profile, setProfile] = (0,
|
|
5813
|
-
const [loading, setLoading] = (0,
|
|
5814
|
-
const [activeTab, setActiveTab] = (0,
|
|
5815
|
-
const [activity, setActivity] = (0,
|
|
5816
|
-
const [activityLoading, setActivityLoading] = (0,
|
|
5817
|
-
const [editOpen, setEditOpen] = (0,
|
|
5818
|
-
const [reportId, setReportId] = (0,
|
|
5819
|
-
const [shareId, setShareId] = (0,
|
|
5820
|
-
const [imageUploading, setImageUploading] = (0,
|
|
5821
|
-
const [previewUri, setPreviewUri] = (0,
|
|
5822
|
-
(0,
|
|
5820
|
+
const [profile, setProfile] = (0, import_react31.useState)(null);
|
|
5821
|
+
const [loading, setLoading] = (0, import_react31.useState)(true);
|
|
5822
|
+
const [activeTab, setActiveTab] = (0, import_react31.useState)("Overview");
|
|
5823
|
+
const [activity, setActivity] = (0, import_react31.useState)([]);
|
|
5824
|
+
const [activityLoading, setActivityLoading] = (0, import_react31.useState)(false);
|
|
5825
|
+
const [editOpen, setEditOpen] = (0, import_react31.useState)(false);
|
|
5826
|
+
const [reportId, setReportId] = (0, import_react31.useState)(null);
|
|
5827
|
+
const [shareId, setShareId] = (0, import_react31.useState)(null);
|
|
5828
|
+
const [imageUploading, setImageUploading] = (0, import_react31.useState)(null);
|
|
5829
|
+
const [previewUri, setPreviewUri] = (0, import_react31.useState)(null);
|
|
5830
|
+
(0, import_react31.useEffect)(() => {
|
|
5823
5831
|
if (!token) return;
|
|
5824
5832
|
let cancelled = false;
|
|
5825
5833
|
setLoading(true);
|
|
@@ -5832,7 +5840,7 @@ function ProfileBody() {
|
|
|
5832
5840
|
cancelled = true;
|
|
5833
5841
|
};
|
|
5834
5842
|
}, [apiUrl, forumId, token]);
|
|
5835
|
-
(0,
|
|
5843
|
+
(0, import_react31.useEffect)(() => {
|
|
5836
5844
|
if (!token) return;
|
|
5837
5845
|
let cancelled = false;
|
|
5838
5846
|
setActivityLoading(true);
|
|
@@ -5848,7 +5856,7 @@ function ProfileBody() {
|
|
|
5848
5856
|
cancelled = true;
|
|
5849
5857
|
};
|
|
5850
5858
|
}, [apiUrl, forumId, activeTab, token]);
|
|
5851
|
-
const updateThreadRow = (0,
|
|
5859
|
+
const updateThreadRow = (0, import_react31.useCallback)((id, fn) => {
|
|
5852
5860
|
setActivity((prev) => prev.map((a) => a.kind === "thread" && a.row.id === id ? { kind: "thread", row: fn(a.row) } : a));
|
|
5853
5861
|
}, []);
|
|
5854
5862
|
function onVote(row, dir) {
|
|
@@ -5883,75 +5891,75 @@ function ProfileBody() {
|
|
|
5883
5891
|
}, token);
|
|
5884
5892
|
setProfile((p) => p ? { ...p, ...updated } : p);
|
|
5885
5893
|
} catch (e) {
|
|
5886
|
-
|
|
5894
|
+
import_react_native46.Alert.alert("Update failed", e instanceof Error ? e.message : `Couldn't update your ${kind}. Please try again.`);
|
|
5887
5895
|
} finally {
|
|
5888
5896
|
setImageUploading(null);
|
|
5889
5897
|
}
|
|
5890
5898
|
}
|
|
5891
|
-
if (loading) return /* @__PURE__ */ (0,
|
|
5899
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.View, { style: styles38.center, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Mascot, { size: 36 }) });
|
|
5892
5900
|
const name = profile?.displayName ?? "You";
|
|
5893
5901
|
const copy = profileEmptyCopy(activeTab);
|
|
5894
|
-
return /* @__PURE__ */ (0,
|
|
5895
|
-
/* @__PURE__ */ (0,
|
|
5896
|
-
|
|
5902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.ScrollView, { contentContainerStyle: styles38.content, children: [
|
|
5903
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
5904
|
+
import_react_native46.Pressable,
|
|
5897
5905
|
{
|
|
5898
5906
|
onPress: () => profile?.bannerUrl && setPreviewUri(profile.bannerUrl),
|
|
5899
5907
|
disabled: !profile?.bannerUrl,
|
|
5900
|
-
style: [
|
|
5908
|
+
style: [styles38.banner, { backgroundColor: tokens["surface-2"] }],
|
|
5901
5909
|
children: [
|
|
5902
|
-
profile?.bannerUrl != null && /* @__PURE__ */ (0,
|
|
5903
|
-
/* @__PURE__ */ (0,
|
|
5904
|
-
/* @__PURE__ */ (0,
|
|
5905
|
-
/* @__PURE__ */ (0,
|
|
5906
|
-
|
|
5910
|
+
profile?.bannerUrl != null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Image, { source: { uri: profile.bannerUrl }, style: import_react_native46.StyleSheet.absoluteFill }),
|
|
5911
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Pressable, { onPress: () => void editImage("banner"), disabled: imageUploading != null, style: [styles38.bannerCam, { backgroundColor: tokens.elev }], children: imageUploading === "banner" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.ActivityIndicator, { size: "small", color: tokens["text-2"] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CameraIcon, { size: 14, color: tokens["text-2"] }) }),
|
|
5912
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: styles38.avatarWrap, children: [
|
|
5913
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5914
|
+
import_react_native46.Pressable,
|
|
5907
5915
|
{
|
|
5908
5916
|
onPress: () => profile?.avatarUrl && setPreviewUri(profile.avatarUrl),
|
|
5909
5917
|
disabled: !profile?.avatarUrl,
|
|
5910
|
-
style: [
|
|
5911
|
-
children: /* @__PURE__ */ (0,
|
|
5918
|
+
style: [styles38.avatarRing, { borderColor: tokens.bg }],
|
|
5919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Avatar, { authorId: profile?.id, author: name, avatarUrl: profile?.avatarUrl, size: 72 })
|
|
5912
5920
|
}
|
|
5913
5921
|
),
|
|
5914
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Pressable, { onPress: () => void editImage("avatar"), disabled: imageUploading != null, style: [styles38.avatarCam, { backgroundColor: tokens.accent }], children: imageUploading === "avatar" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.ActivityIndicator, { size: "small", color: tokens["accent-fg"] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CameraIcon, { size: 12, color: tokens["accent-fg"] }) })
|
|
5915
5923
|
] })
|
|
5916
5924
|
]
|
|
5917
5925
|
}
|
|
5918
5926
|
),
|
|
5919
|
-
/* @__PURE__ */ (0,
|
|
5920
|
-
/* @__PURE__ */ (0,
|
|
5921
|
-
/* @__PURE__ */ (0,
|
|
5922
|
-
/* @__PURE__ */ (0,
|
|
5923
|
-
/* @__PURE__ */ (0,
|
|
5927
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: { paddingHorizontal: 16 }, children: [
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: styles38.nameRow, children: [
|
|
5929
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: { flex: 1 }, children: [
|
|
5930
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.name, { color: tokens.text }], children: name }),
|
|
5931
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.Text, { style: [styles38.handle, { color: tokens.muted }], children: [
|
|
5924
5932
|
"/",
|
|
5925
5933
|
name
|
|
5926
5934
|
] })
|
|
5927
5935
|
] }),
|
|
5928
|
-
/* @__PURE__ */ (0,
|
|
5929
|
-
/* @__PURE__ */ (0,
|
|
5930
|
-
/* @__PURE__ */ (0,
|
|
5936
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: { flexDirection: "row", gap: 8 }, children: [
|
|
5937
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Pressable, { onPress: openComposer, hitSlop: 8, style: styles38.editIconBtn, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PlusIcon, { size: 16, color: tokens.text }) }),
|
|
5938
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Pressable, { onPress: () => setEditOpen(true), hitSlop: 8, style: styles38.editIconBtn, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PencilIcon, { size: 15, color: tokens.text }) })
|
|
5931
5939
|
] })
|
|
5932
5940
|
] }),
|
|
5933
|
-
profile?.bio != null && profile.bio.trim().length > 0 && /* @__PURE__ */ (0,
|
|
5934
|
-
profile && /* @__PURE__ */ (0,
|
|
5941
|
+
profile?.bio != null && profile.bio.trim().length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.bio, { color: tokens["text-2"] }], children: profile.bio }),
|
|
5942
|
+
profile && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SocialLinks, { links: profile.socialLinks, onEditProfile: () => setEditOpen(true) })
|
|
5935
5943
|
] }),
|
|
5936
|
-
/* @__PURE__ */ (0,
|
|
5937
|
-
/* @__PURE__ */ (0,
|
|
5938
|
-
/* @__PURE__ */ (0,
|
|
5939
|
-
/* @__PURE__ */ (0,
|
|
5944
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: [styles38.karmaRow, { borderTopColor: tokens.border }], children: [
|
|
5945
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: styles38.karmaBlock, children: [
|
|
5946
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.karmaValue, { color: tokens.text }], children: (profile?.postKarma ?? 0).toLocaleString() }),
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.karmaLabel, { color: tokens.muted }], children: "Post Karma" })
|
|
5940
5948
|
] }),
|
|
5941
|
-
/* @__PURE__ */ (0,
|
|
5942
|
-
/* @__PURE__ */ (0,
|
|
5943
|
-
/* @__PURE__ */ (0,
|
|
5944
|
-
/* @__PURE__ */ (0,
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.View, { style: [styles38.karmaDivider, { backgroundColor: tokens.border }] }),
|
|
5950
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: styles38.karmaBlock, children: [
|
|
5951
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.karmaValue, { color: tokens.text }], children: (profile?.commentKarma ?? 0).toLocaleString() }),
|
|
5952
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.karmaLabel, { color: tokens.muted }], children: "Comment Karma" })
|
|
5945
5953
|
] })
|
|
5946
5954
|
] }),
|
|
5947
|
-
/* @__PURE__ */ (0,
|
|
5948
|
-
/* @__PURE__ */ (0,
|
|
5949
|
-
activityLoading ? /* @__PURE__ */ (0,
|
|
5950
|
-
/* @__PURE__ */ (0,
|
|
5951
|
-
/* @__PURE__ */ (0,
|
|
5952
|
-
/* @__PURE__ */ (0,
|
|
5953
|
-
/* @__PURE__ */ (0,
|
|
5954
|
-
] }) : /* @__PURE__ */ (0,
|
|
5955
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.View, { style: [styles38.divider, { backgroundColor: tokens.border }] }),
|
|
5956
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.View, { style: { marginTop: 6, marginBottom: 14 }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TabPills, { tabs: PROFILE_TABS, active: activeTab, onSelect: setActiveTab }) }),
|
|
5957
|
+
activityLoading ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.View, { style: { alignItems: "center", paddingVertical: 30 }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Mascot, { size: 36 }) }) : activity.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native46.View, { style: styles38.empty, children: [
|
|
5958
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Mascot, { size: 88, animated: false, badge: false }),
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.emptyTitle, { color: tokens.text }], children: copy.title }),
|
|
5960
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: [styles38.emptyDesc, { color: tokens.muted }], children: copy.description }),
|
|
5961
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Pressable, { onPress: () => setEditOpen(true), style: [styles38.settingsBtn, { backgroundColor: tokens.text }], children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.Text, { style: { color: tokens.bg, fontSize: 13.5, fontWeight: "700" }, children: "Update Settings" }) })
|
|
5962
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native46.View, { style: { paddingHorizontal: 16 }, children: activity.map((a, i) => a.kind === "thread" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5955
5963
|
PostRow,
|
|
5956
5964
|
{
|
|
5957
5965
|
row: a.row,
|
|
@@ -5963,7 +5971,7 @@ function ProfileBody() {
|
|
|
5963
5971
|
onShare: () => setShareId(a.row.id)
|
|
5964
5972
|
},
|
|
5965
5973
|
`t-${a.row.id}-${i}`
|
|
5966
|
-
) : /* @__PURE__ */ (0,
|
|
5974
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5967
5975
|
ProfileCommentCard,
|
|
5968
5976
|
{
|
|
5969
5977
|
comment: a.comment,
|
|
@@ -5973,7 +5981,7 @@ function ProfileBody() {
|
|
|
5973
5981
|
},
|
|
5974
5982
|
`c-${a.comment.id}-${i}`
|
|
5975
5983
|
)) }),
|
|
5976
|
-
editOpen && profile && /* @__PURE__ */ (0,
|
|
5984
|
+
editOpen && profile && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5977
5985
|
EditProfileSheet,
|
|
5978
5986
|
{
|
|
5979
5987
|
apiUrl,
|
|
@@ -5987,21 +5995,21 @@ function ProfileBody() {
|
|
|
5987
5995
|
}
|
|
5988
5996
|
}
|
|
5989
5997
|
),
|
|
5990
|
-
reportId && /* @__PURE__ */ (0,
|
|
5998
|
+
reportId && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ReportSheet, { target: "post", onClose: () => setReportId(null), onSubmit: (reason) => {
|
|
5991
5999
|
if (token) void reportThread(apiUrl, forumId, reportId, reason, token).catch(() => {
|
|
5992
6000
|
});
|
|
5993
6001
|
} }),
|
|
5994
|
-
shareId && /* @__PURE__ */ (0,
|
|
6002
|
+
shareId && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ShareSheet, { apiUrl, forumId, token, onClose: () => setShareId(null), onShare: (ids) => {
|
|
5995
6003
|
if (token && ids.length) void shareThreadWithUsers(apiUrl, forumId, shareId, ids, void 0, token).catch(() => {
|
|
5996
6004
|
});
|
|
5997
6005
|
} }),
|
|
5998
|
-
previewUri && /* @__PURE__ */ (0,
|
|
6006
|
+
previewUri && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageLightbox, { uri: previewUri, onClose: () => setPreviewUri(null) })
|
|
5999
6007
|
] });
|
|
6000
6008
|
}
|
|
6001
6009
|
function ProfileScreen() {
|
|
6002
|
-
return /* @__PURE__ */ (0,
|
|
6010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ProfileBody, {}) });
|
|
6003
6011
|
}
|
|
6004
|
-
var
|
|
6012
|
+
var styles38 = import_react_native46.StyleSheet.create({
|
|
6005
6013
|
center: { flex: 1, alignItems: "center", justifyContent: "center" },
|
|
6006
6014
|
content: { paddingBottom: 110 },
|
|
6007
6015
|
banner: { height: 120, marginBottom: 44, position: "relative" },
|
|
@@ -6033,52 +6041,52 @@ var styles37 = import_react_native45.StyleSheet.create({
|
|
|
6033
6041
|
});
|
|
6034
6042
|
|
|
6035
6043
|
// src/screens/SearchScreen.tsx
|
|
6036
|
-
var
|
|
6037
|
-
var
|
|
6044
|
+
var import_react32 = require("react");
|
|
6045
|
+
var import_react_native47 = require("react-native");
|
|
6038
6046
|
var import_native7 = require("@react-navigation/native");
|
|
6039
|
-
var
|
|
6047
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6040
6048
|
var TABS2 = ["All", "Threads", "Comments", "Profiles", "Media"];
|
|
6041
6049
|
var PREVIEW_LIMIT = 5;
|
|
6042
6050
|
var FULL_LIMIT = 20;
|
|
6043
6051
|
function ThreadRow({ r, onPress }) {
|
|
6044
6052
|
const { tokens } = useTheme();
|
|
6045
|
-
return /* @__PURE__ */ (0,
|
|
6046
|
-
/* @__PURE__ */ (0,
|
|
6047
|
-
/* @__PURE__ */ (0,
|
|
6048
|
-
/* @__PURE__ */ (0,
|
|
6049
|
-
/* @__PURE__ */ (0,
|
|
6053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Pressable, { onPress, style: [styles39.row, { borderBottomColor: tokens.border }], children: [
|
|
6054
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.View, { style: styles39.rowHead, children: [
|
|
6055
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Avatar, { authorId: r.authorId, author: r.authorDisplayName, avatarUrl: r.authorAvatarUrl, size: 20 }),
|
|
6056
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.author, { color: tokens.text }], children: r.authorDisplayName }),
|
|
6057
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.time, { color: tokens.muted }], children: [
|
|
6050
6058
|
"\xB7 ",
|
|
6051
6059
|
fmtRelativeTime(r.createdAt)
|
|
6052
6060
|
] })
|
|
6053
6061
|
] }),
|
|
6054
|
-
/* @__PURE__ */ (0,
|
|
6055
|
-
/* @__PURE__ */ (0,
|
|
6056
|
-
/* @__PURE__ */ (0,
|
|
6057
|
-
r.bodySnippet ? /* @__PURE__ */ (0,
|
|
6058
|
-
/* @__PURE__ */ (0,
|
|
6062
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.View, { style: styles39.rowBody, children: [
|
|
6063
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.View, { style: { flex: 1 }, children: [
|
|
6064
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.title, { color: tokens.text }], numberOfLines: 2, children: r.title }),
|
|
6065
|
+
r.bodySnippet ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.snippet, { color: tokens["text-2"] }], numberOfLines: 2, children: r.bodySnippet }) : null,
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.meta, { color: tokens.muted }], children: [
|
|
6059
6067
|
r.voteCounts.up - r.voteCounts.down,
|
|
6060
6068
|
" votes \xB7 ",
|
|
6061
6069
|
r.commentCount,
|
|
6062
6070
|
" comments"
|
|
6063
6071
|
] })
|
|
6064
6072
|
] }),
|
|
6065
|
-
r.imageUrl != null && /* @__PURE__ */ (0,
|
|
6073
|
+
r.imageUrl != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Thumbnail, { imageUrl: r.imageUrl, square: 64, radius: 10 })
|
|
6066
6074
|
] })
|
|
6067
6075
|
] });
|
|
6068
6076
|
}
|
|
6069
6077
|
function CommentResultRow({ r, onPress }) {
|
|
6070
6078
|
const { tokens } = useTheme();
|
|
6071
|
-
return /* @__PURE__ */ (0,
|
|
6072
|
-
/* @__PURE__ */ (0,
|
|
6073
|
-
/* @__PURE__ */ (0,
|
|
6074
|
-
/* @__PURE__ */ (0,
|
|
6075
|
-
/* @__PURE__ */ (0,
|
|
6079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Pressable, { onPress, style: [styles39.row, { borderBottomColor: tokens.border }], children: [
|
|
6080
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.View, { style: styles39.rowHead, children: [
|
|
6081
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Avatar, { authorId: r.authorId, author: r.authorDisplayName, avatarUrl: r.authorAvatarUrl, size: 20 }),
|
|
6082
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.author, { color: tokens.text }], children: r.authorDisplayName }),
|
|
6083
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.time, { color: tokens.muted }], children: [
|
|
6076
6084
|
"\xB7 ",
|
|
6077
6085
|
fmtRelativeTime(r.createdAt)
|
|
6078
6086
|
] })
|
|
6079
6087
|
] }),
|
|
6080
|
-
/* @__PURE__ */ (0,
|
|
6081
|
-
/* @__PURE__ */ (0,
|
|
6088
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.snippet, { color: tokens["text-2"] }], numberOfLines: 3, children: r.bodySnippet }),
|
|
6089
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.meta, { color: tokens.muted }], numberOfLines: 1, children: [
|
|
6082
6090
|
"in: ",
|
|
6083
6091
|
r.threadTitle
|
|
6084
6092
|
] })
|
|
@@ -6086,11 +6094,11 @@ function CommentResultRow({ r, onPress }) {
|
|
|
6086
6094
|
}
|
|
6087
6095
|
function ProfileRow({ r }) {
|
|
6088
6096
|
const { tokens } = useTheme();
|
|
6089
|
-
return /* @__PURE__ */ (0,
|
|
6090
|
-
/* @__PURE__ */ (0,
|
|
6091
|
-
/* @__PURE__ */ (0,
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6093
|
-
/* @__PURE__ */ (0,
|
|
6097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.View, { style: [styles39.row, { borderBottomColor: tokens.border }], children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.View, { style: styles39.profileRow, children: [
|
|
6098
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Avatar, { authorId: r.id, author: r.displayName, avatarUrl: r.avatarUrl, size: 36 }),
|
|
6099
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.View, { children: [
|
|
6100
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.author, { color: tokens.text, fontSize: 14 }], children: r.displayName }),
|
|
6101
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.meta, { color: tokens.muted, marginTop: 2 }], children: [
|
|
6094
6102
|
r.karma,
|
|
6095
6103
|
" karma"
|
|
6096
6104
|
] })
|
|
@@ -6099,9 +6107,9 @@ function ProfileRow({ r }) {
|
|
|
6099
6107
|
}
|
|
6100
6108
|
function SectionHeader({ title, onSeeAll }) {
|
|
6101
6109
|
const { tokens } = useTheme();
|
|
6102
|
-
return /* @__PURE__ */ (0,
|
|
6103
|
-
/* @__PURE__ */ (0,
|
|
6104
|
-
/* @__PURE__ */ (0,
|
|
6110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.View, { style: styles39.sectionHead, children: [
|
|
6111
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.sectionTitle, { color: tokens.text }], children: title }),
|
|
6112
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Pressable, { onPress: onSeeAll, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ChevronRightIcon, { size: 16, color: tokens.accent }) })
|
|
6105
6113
|
] });
|
|
6106
6114
|
}
|
|
6107
6115
|
function SearchBody() {
|
|
@@ -6113,13 +6121,13 @@ function SearchBody() {
|
|
|
6113
6121
|
const query = route.params.query;
|
|
6114
6122
|
const { apiUrl, forumId } = session;
|
|
6115
6123
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
6116
|
-
const [tab, setTab] = (0,
|
|
6117
|
-
const [threads, setThreads] = (0,
|
|
6118
|
-
const [comments, setComments] = (0,
|
|
6119
|
-
const [users, setUsers] = (0,
|
|
6120
|
-
const [loading, setLoading] = (0,
|
|
6121
|
-
const [querySuggestion, setQuerySuggestion] = (0,
|
|
6122
|
-
(0,
|
|
6124
|
+
const [tab, setTab] = (0, import_react32.useState)("All");
|
|
6125
|
+
const [threads, setThreads] = (0, import_react32.useState)([]);
|
|
6126
|
+
const [comments, setComments] = (0, import_react32.useState)([]);
|
|
6127
|
+
const [users, setUsers] = (0, import_react32.useState)([]);
|
|
6128
|
+
const [loading, setLoading] = (0, import_react32.useState)(true);
|
|
6129
|
+
const [querySuggestion, setQuerySuggestion] = (0, import_react32.useState)({ query: null, isRelated: false });
|
|
6130
|
+
(0, import_react32.useEffect)(() => {
|
|
6123
6131
|
if (!token) return;
|
|
6124
6132
|
let cancelled = false;
|
|
6125
6133
|
setLoading(true);
|
|
@@ -6172,59 +6180,59 @@ function SearchBody() {
|
|
|
6172
6180
|
const showComments = tab === "All" || tab === "Comments";
|
|
6173
6181
|
const showProfiles = tab === "All" || tab === "Profiles";
|
|
6174
6182
|
const showMedia = tab === "All" || tab === "Media";
|
|
6175
|
-
return /* @__PURE__ */ (0,
|
|
6176
|
-
querySuggestion.isRelated && querySuggestion.query && /* @__PURE__ */ (0,
|
|
6177
|
-
|
|
6183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.ScrollView, { contentContainerStyle: styles39.content, onScroll, scrollEventThrottle: 16, children: [
|
|
6184
|
+
querySuggestion.isRelated && querySuggestion.query && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6185
|
+
import_react_native47.Pressable,
|
|
6178
6186
|
{
|
|
6179
|
-
style:
|
|
6187
|
+
style: styles39.suggestionBanner,
|
|
6180
6188
|
onPress: () => navigation.navigate("Search", { query: querySuggestion.query }),
|
|
6181
|
-
children: /* @__PURE__ */ (0,
|
|
6189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.suggestionBannerText, { color: tokens["text-2"] }], children: [
|
|
6182
6190
|
'No results for "',
|
|
6183
|
-
/* @__PURE__ */ (0,
|
|
6191
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: { fontWeight: "700" }, children: query }),
|
|
6184
6192
|
'". Showing related results for ',
|
|
6185
|
-
/* @__PURE__ */ (0,
|
|
6193
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: { color: tokens.accent, fontWeight: "500" }, children: querySuggestion.query })
|
|
6186
6194
|
] })
|
|
6187
6195
|
}
|
|
6188
6196
|
),
|
|
6189
|
-
!querySuggestion.isRelated && querySuggestion.query && querySuggestion.query.toLowerCase() !== query.toLowerCase() && /* @__PURE__ */ (0,
|
|
6190
|
-
|
|
6197
|
+
!querySuggestion.isRelated && querySuggestion.query && querySuggestion.query.toLowerCase() !== query.toLowerCase() && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6198
|
+
import_react_native47.Pressable,
|
|
6191
6199
|
{
|
|
6192
|
-
style:
|
|
6200
|
+
style: styles39.suggestionBanner,
|
|
6193
6201
|
onPress: () => navigation.navigate("Search", { query: querySuggestion.query }),
|
|
6194
|
-
children: /* @__PURE__ */ (0,
|
|
6202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.suggestionBannerText, { color: tokens["text-2"] }], children: [
|
|
6195
6203
|
"Did you mean: ",
|
|
6196
|
-
/* @__PURE__ */ (0,
|
|
6204
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: { color: tokens.accent, fontWeight: "500" }, children: querySuggestion.query }),
|
|
6197
6205
|
"?"
|
|
6198
6206
|
] })
|
|
6199
6207
|
}
|
|
6200
6208
|
),
|
|
6201
|
-
/* @__PURE__ */ (0,
|
|
6202
|
-
loading ? /* @__PURE__ */ (0,
|
|
6203
|
-
showThreads && /* @__PURE__ */ (0,
|
|
6204
|
-
tab === "All" && /* @__PURE__ */ (0,
|
|
6205
|
-
threads.length === 0 ? tab !== "All" && /* @__PURE__ */ (0,
|
|
6209
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TabPills, { tabs: TABS2, active: tab, onSelect: (t) => switchTab(t) }),
|
|
6210
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.View, { style: { alignItems: "center", marginTop: 40 }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Mascot, { size: 32 }) }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
6211
|
+
showThreads && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
6212
|
+
tab === "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SectionHeader, { title: "Threads", onSeeAll: () => switchTab("Threads") }),
|
|
6213
|
+
threads.length === 0 ? tab !== "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.empty, { color: tokens["text-2"] }], children: "No thread results" }) : threads.map((r) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ThreadRow, { r, onPress: () => navigation.navigate("Thread", { threadId: r.threadId }) }, r.threadId))
|
|
6206
6214
|
] }),
|
|
6207
|
-
showComments && /* @__PURE__ */ (0,
|
|
6208
|
-
tab === "All" && /* @__PURE__ */ (0,
|
|
6209
|
-
comments.length === 0 ? tab !== "All" && /* @__PURE__ */ (0,
|
|
6215
|
+
showComments && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
6216
|
+
tab === "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SectionHeader, { title: "Comments", onSeeAll: () => switchTab("Comments") }),
|
|
6217
|
+
comments.length === 0 ? tab !== "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.empty, { color: tokens["text-2"] }], children: "No comment results" }) : comments.map((r) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CommentResultRow, { r, onPress: () => navigation.navigate("Thread", { threadId: r.threadId }) }, r.commentId))
|
|
6210
6218
|
] }),
|
|
6211
|
-
showProfiles && /* @__PURE__ */ (0,
|
|
6212
|
-
tab === "All" && /* @__PURE__ */ (0,
|
|
6213
|
-
users.length === 0 ? tab !== "All" && /* @__PURE__ */ (0,
|
|
6219
|
+
showProfiles && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
6220
|
+
tab === "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SectionHeader, { title: "Profiles", onSeeAll: () => switchTab("Profiles") }),
|
|
6221
|
+
users.length === 0 ? tab !== "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.empty, { color: tokens["text-2"] }], children: "No profile results" }) : users.map((r) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ProfileRow, { r }, r.id))
|
|
6214
6222
|
] }),
|
|
6215
|
-
showMedia && /* @__PURE__ */ (0,
|
|
6216
|
-
tab === "All" && /* @__PURE__ */ (0,
|
|
6217
|
-
mediaThreads.length === 0 ? tab !== "All" && /* @__PURE__ */ (0,
|
|
6218
|
-
|
|
6223
|
+
showMedia && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
6224
|
+
tab === "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SectionHeader, { title: "Media", onSeeAll: () => switchTab("Media") }),
|
|
6225
|
+
mediaThreads.length === 0 ? tab !== "All" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: [styles39.empty, { color: tokens["text-2"] }], children: "No media results" }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.View, { style: styles39.mediaGrid, children: mediaThreads.map((r) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
6226
|
+
import_react_native47.Pressable,
|
|
6219
6227
|
{
|
|
6220
|
-
style:
|
|
6228
|
+
style: styles39.mediaCell,
|
|
6221
6229
|
onPress: () => navigation.navigate("Thread", { threadId: r.threadId }),
|
|
6222
|
-
children: /* @__PURE__ */ (0,
|
|
6230
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Thumbnail, { imageUrl: r.imageUrl, radius: 10, style: { width: "100%", aspectRatio: 1 } })
|
|
6223
6231
|
},
|
|
6224
6232
|
r.threadId
|
|
6225
6233
|
)) })
|
|
6226
6234
|
] }),
|
|
6227
|
-
tab === "All" && !loading && threads.length === 0 && comments.length === 0 && users.length === 0 && /* @__PURE__ */ (0,
|
|
6235
|
+
tab === "All" && !loading && threads.length === 0 && comments.length === 0 && users.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_native47.Text, { style: [styles39.empty, { color: tokens["text-2"] }], children: [
|
|
6228
6236
|
'No results for "',
|
|
6229
6237
|
query,
|
|
6230
6238
|
'"'
|
|
@@ -6233,9 +6241,9 @@ function SearchBody() {
|
|
|
6233
6241
|
] });
|
|
6234
6242
|
}
|
|
6235
6243
|
function SearchScreen() {
|
|
6236
|
-
return /* @__PURE__ */ (0,
|
|
6244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SearchBody, {}) });
|
|
6237
6245
|
}
|
|
6238
|
-
var
|
|
6246
|
+
var styles39 = import_react_native47.StyleSheet.create({
|
|
6239
6247
|
content: { paddingTop: 16, paddingBottom: 110 },
|
|
6240
6248
|
sectionHead: {
|
|
6241
6249
|
flexDirection: "row",
|
|
@@ -6263,18 +6271,18 @@ var styles38 = import_react_native46.StyleSheet.create({
|
|
|
6263
6271
|
});
|
|
6264
6272
|
|
|
6265
6273
|
// src/screens/SearchInputScreen.tsx
|
|
6266
|
-
var
|
|
6267
|
-
var
|
|
6274
|
+
var import_react33 = require("react");
|
|
6275
|
+
var import_react_native48 = require("react-native");
|
|
6268
6276
|
var import_react_native_svg5 = __toESM(require("react-native-svg"));
|
|
6269
6277
|
var import_react_native_safe_area_context9 = require("react-native-safe-area-context");
|
|
6270
6278
|
var import_native8 = require("@react-navigation/native");
|
|
6271
6279
|
var import_async_storage2 = __toESM(require("@react-native-async-storage/async-storage"));
|
|
6272
|
-
var
|
|
6273
|
-
var AnimatedRect =
|
|
6280
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
6281
|
+
var AnimatedRect = import_react_native48.Animated.createAnimatedComponent(import_react_native_svg5.Rect);
|
|
6274
6282
|
var HISTORY_KEY = "fk_search_history";
|
|
6275
6283
|
var MAX_HISTORY = 10;
|
|
6276
6284
|
var DEBOUNCE_MS = 300;
|
|
6277
|
-
var ANDROID_TOP_EXTRA5 =
|
|
6285
|
+
var ANDROID_TOP_EXTRA5 = import_react_native48.Platform.OS === "android" ? 12 : 0;
|
|
6278
6286
|
async function loadHistory() {
|
|
6279
6287
|
try {
|
|
6280
6288
|
const raw = await import_async_storage2.default.getItem(HISTORY_KEY);
|
|
@@ -6308,16 +6316,16 @@ function SearchInputScreen() {
|
|
|
6308
6316
|
const session = useSession();
|
|
6309
6317
|
const { apiUrl, forumId } = session;
|
|
6310
6318
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
6311
|
-
const [query, setQuery] = (0,
|
|
6312
|
-
const [aiMode, setAiMode] = (0,
|
|
6313
|
-
const [askPillSize, setAskPillSize] = (0,
|
|
6314
|
-
const [history, setHistory] = (0,
|
|
6315
|
-
const [latestPosts, setLatestPosts] = (0,
|
|
6316
|
-
const [liveThreads, setLiveThreads] = (0,
|
|
6317
|
-
const [liveComments, setLiveComments] = (0,
|
|
6318
|
-
const [searching, setSearching] = (0,
|
|
6319
|
-
const debounceRef = (0,
|
|
6320
|
-
(0,
|
|
6319
|
+
const [query, setQuery] = (0, import_react33.useState)("");
|
|
6320
|
+
const [aiMode, setAiMode] = (0, import_react33.useState)(false);
|
|
6321
|
+
const [askPillSize, setAskPillSize] = (0, import_react33.useState)({ w: 0, h: 0 });
|
|
6322
|
+
const [history, setHistory] = (0, import_react33.useState)([]);
|
|
6323
|
+
const [latestPosts, setLatestPosts] = (0, import_react33.useState)([]);
|
|
6324
|
+
const [liveThreads, setLiveThreads] = (0, import_react33.useState)([]);
|
|
6325
|
+
const [liveComments, setLiveComments] = (0, import_react33.useState)([]);
|
|
6326
|
+
const [searching, setSearching] = (0, import_react33.useState)(false);
|
|
6327
|
+
const debounceRef = (0, import_react33.useRef)(null);
|
|
6328
|
+
(0, import_react33.useEffect)(() => {
|
|
6321
6329
|
void loadHistory().then(setHistory);
|
|
6322
6330
|
if (!token) return;
|
|
6323
6331
|
void listThreads(apiUrl, forumId, token, { sort: "new", limit: 8 }).then((r) => setLatestPosts(r.threads)).catch(() => {
|
|
@@ -6326,7 +6334,7 @@ function SearchInputScreen() {
|
|
|
6326
6334
|
function handleAskPress() {
|
|
6327
6335
|
setAiMode((prev) => !prev);
|
|
6328
6336
|
}
|
|
6329
|
-
const runLiveSearch = (0,
|
|
6337
|
+
const runLiveSearch = (0, import_react33.useCallback)((q) => {
|
|
6330
6338
|
if (!token || !q.trim()) {
|
|
6331
6339
|
setLiveThreads([]);
|
|
6332
6340
|
setLiveComments([]);
|
|
@@ -6385,14 +6393,14 @@ function SearchInputScreen() {
|
|
|
6385
6393
|
}
|
|
6386
6394
|
const isEmpty = !query.trim();
|
|
6387
6395
|
const canSubmit = !!query.trim();
|
|
6388
|
-
return /* @__PURE__ */ (0,
|
|
6389
|
-
/* @__PURE__ */ (0,
|
|
6390
|
-
/* @__PURE__ */ (0,
|
|
6391
|
-
aiMode && /* @__PURE__ */ (0,
|
|
6392
|
-
/* @__PURE__ */ (0,
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6394
|
-
/* @__PURE__ */ (0,
|
|
6395
|
-
|
|
6396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: [styles40.root, { backgroundColor: tokens.bg }], children: [
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.View, { style: { height: insets.top + ANDROID_TOP_EXTRA5 } }),
|
|
6398
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: [styles40.searchBox, { backgroundColor: mode === "dark" ? tokens.surface : "#dde1e6" }], children: [
|
|
6399
|
+
aiMode && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SearchBoxGlowBorder, {}),
|
|
6400
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles40.searchTop, children: [
|
|
6401
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Pressable, { onPress: () => navigation.goBack(), hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.View, { style: { transform: [{ scaleX: -1 }] }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ArrowRightIcon, { size: 20, color: tokens.text }) }) }),
|
|
6402
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6403
|
+
import_react_native48.TextInput,
|
|
6396
6404
|
{
|
|
6397
6405
|
value: query,
|
|
6398
6406
|
onChangeText: handleQueryChange,
|
|
@@ -6401,27 +6409,27 @@ function SearchInputScreen() {
|
|
|
6401
6409
|
autoFocus: true,
|
|
6402
6410
|
placeholder: "Search",
|
|
6403
6411
|
placeholderTextColor: tokens.faint,
|
|
6404
|
-
style: [
|
|
6412
|
+
style: [styles40.searchInput, { color: tokens.text }]
|
|
6405
6413
|
}
|
|
6406
6414
|
),
|
|
6407
|
-
query.length > 0 && /* @__PURE__ */ (0,
|
|
6415
|
+
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Pressable, { onPress: clearQuery, hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.clearBtn, { color: tokens.muted }], children: "\u2715" }) })
|
|
6408
6416
|
] }),
|
|
6409
|
-
/* @__PURE__ */ (0,
|
|
6410
|
-
/* @__PURE__ */ (0,
|
|
6411
|
-
|
|
6417
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles40.searchBottom, children: [
|
|
6418
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
6419
|
+
import_react_native48.Pressable,
|
|
6412
6420
|
{
|
|
6413
|
-
style: [
|
|
6421
|
+
style: [styles40.askPill, { backgroundColor: aiMode ? "#7b5cff11" : tokens["surface-2"] }],
|
|
6414
6422
|
onPress: handleAskPress,
|
|
6415
6423
|
hitSlop: 6,
|
|
6416
6424
|
onLayout: (e) => setAskPillSize({ w: e.nativeEvent.layout.width, h: e.nativeEvent.layout.height }),
|
|
6417
6425
|
children: [
|
|
6418
|
-
aiMode && askPillSize.w > 0 && /* @__PURE__ */ (0,
|
|
6419
|
-
/* @__PURE__ */ (0,
|
|
6420
|
-
/* @__PURE__ */ (0,
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6422
|
-
/* @__PURE__ */ (0,
|
|
6426
|
+
aiMode && askPillSize.w > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native_svg5.default, { width: askPillSize.w, height: askPillSize.h, style: import_react_native48.StyleSheet.absoluteFill, children: [
|
|
6427
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native_svg5.LinearGradient, { id: "fkAskPillGrad", x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
6428
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Stop, { offset: "0", stopColor: "#3f7ee2" }),
|
|
6429
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Stop, { offset: "0.55", stopColor: "#7b5cff" }),
|
|
6430
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Stop, { offset: "1", stopColor: "#37e0e6" })
|
|
6423
6431
|
] }) }),
|
|
6424
|
-
/* @__PURE__ */ (0,
|
|
6432
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6425
6433
|
import_react_native_svg5.Rect,
|
|
6426
6434
|
{
|
|
6427
6435
|
x: 0.75,
|
|
@@ -6436,52 +6444,52 @@ function SearchInputScreen() {
|
|
|
6436
6444
|
}
|
|
6437
6445
|
)
|
|
6438
6446
|
] }),
|
|
6439
|
-
/* @__PURE__ */ (0,
|
|
6440
|
-
/* @__PURE__ */ (0,
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SparkleIcon, { size: 14 }),
|
|
6448
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.askLabel, { color: aiMode ? "#7b5cff" : tokens["text-2"] }], children: "Ask" })
|
|
6441
6449
|
]
|
|
6442
6450
|
}
|
|
6443
6451
|
),
|
|
6444
|
-
aiMode && /* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6446
|
-
|
|
6452
|
+
aiMode && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.askHint, { color: tokens.muted }], numberOfLines: 1, children: "summarise the top conversations" }),
|
|
6453
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6454
|
+
import_react_native48.Pressable,
|
|
6447
6455
|
{
|
|
6448
|
-
style: [
|
|
6456
|
+
style: [styles40.submitBtn, { backgroundColor: tokens.accent, opacity: canSubmit ? 1 : 0.35 }],
|
|
6449
6457
|
onPress: () => submit(query),
|
|
6450
6458
|
hitSlop: 6,
|
|
6451
|
-
children: /* @__PURE__ */ (0,
|
|
6459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ChevronRightIcon, { size: 18, color: "#fff" })
|
|
6452
6460
|
}
|
|
6453
6461
|
)
|
|
6454
6462
|
] })
|
|
6455
6463
|
] }),
|
|
6456
|
-
/* @__PURE__ */ (0,
|
|
6457
|
-
history.length > 0 && /* @__PURE__ */ (0,
|
|
6458
|
-
/* @__PURE__ */ (0,
|
|
6459
|
-
history.map((q) => /* @__PURE__ */ (0,
|
|
6460
|
-
/* @__PURE__ */ (0,
|
|
6461
|
-
/* @__PURE__ */ (0,
|
|
6462
|
-
/* @__PURE__ */ (0,
|
|
6464
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.KeyboardAvoidingView, { behavior: import_react_native48.Platform.OS === "ios" ? "padding" : void 0, style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: styles40.body, children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
6465
|
+
history.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
6466
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.sectionTitle, { color: tokens["text-2"] }], children: "Recent" }),
|
|
6467
|
+
history.map((q) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles40.historyRow, children: [
|
|
6468
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Pressable, { style: styles40.historyMain, onPress: () => handleHistoryTap(q), children: [
|
|
6469
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ClockIcon, { size: 15, color: tokens.muted }),
|
|
6470
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.historyText, { color: tokens["text-2"] }], numberOfLines: 1, children: q })
|
|
6463
6471
|
] }),
|
|
6464
|
-
/* @__PURE__ */ (0,
|
|
6472
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Pressable, { onPress: () => void handleRemoveHistory(q), hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.historyClear, { color: tokens.muted }], children: "\u2715" }) })
|
|
6465
6473
|
] }, q))
|
|
6466
6474
|
] }),
|
|
6467
|
-
latestPosts.length > 0 && /* @__PURE__ */ (0,
|
|
6468
|
-
/* @__PURE__ */ (0,
|
|
6469
|
-
latestPosts.map((t) => /* @__PURE__ */ (0,
|
|
6475
|
+
latestPosts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.sectionTitle, { color: tokens["text-2"], marginTop: history.length > 0 ? 28 : 0 }], children: "Latest" }),
|
|
6477
|
+
latestPosts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LatestRow, { thread: t, onPress: () => navigation.navigate("Thread", { threadId: t.id }) }, t.id))
|
|
6470
6478
|
] }),
|
|
6471
|
-
history.length === 0 && latestPosts.length === 0 && /* @__PURE__ */ (0,
|
|
6472
|
-
/* @__PURE__ */ (0,
|
|
6473
|
-
/* @__PURE__ */ (0,
|
|
6479
|
+
history.length === 0 && latestPosts.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles40.empty, children: [
|
|
6480
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Mascot, { size: 32 }),
|
|
6481
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.emptyText, { color: tokens["text-2"] }], children: "Search posts, comments, and people" })
|
|
6474
6482
|
] })
|
|
6475
|
-
] }) : /* @__PURE__ */ (0,
|
|
6476
|
-
liveThreads.length > 0 && /* @__PURE__ */ (0,
|
|
6477
|
-
/* @__PURE__ */ (0,
|
|
6478
|
-
liveThreads.map((r) => /* @__PURE__ */ (0,
|
|
6483
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: !(searching && liveThreads.length === 0 && liveComments.length === 0) && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
6484
|
+
liveThreads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
6485
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.sectionTitle, { color: tokens["text-2"] }], children: "Threads" }),
|
|
6486
|
+
liveThreads.map((r) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LiveThreadRow, { r, onPress: () => handleResultTap(r.threadId, query) }, r.threadId))
|
|
6479
6487
|
] }),
|
|
6480
|
-
liveComments.length > 0 && /* @__PURE__ */ (0,
|
|
6481
|
-
/* @__PURE__ */ (0,
|
|
6482
|
-
liveComments.map((r) => /* @__PURE__ */ (0,
|
|
6488
|
+
liveComments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
6489
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.sectionTitle, { color: tokens["text-2"], marginTop: liveThreads.length > 0 ? 24 : 0 }], children: "Comments" }),
|
|
6490
|
+
liveComments.map((r) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(LiveCommentRow, { r, onPress: () => handleResultTap(r.threadId, query) }, r.commentId))
|
|
6483
6491
|
] }),
|
|
6484
|
-
!searching && liveThreads.length === 0 && liveComments.length === 0 && /* @__PURE__ */ (0,
|
|
6492
|
+
!searching && liveThreads.length === 0 && liveComments.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Text, { style: [styles40.noResults, { color: tokens["text-2"] }], children: [
|
|
6485
6493
|
'No results for "',
|
|
6486
6494
|
query,
|
|
6487
6495
|
'"'
|
|
@@ -6493,34 +6501,34 @@ var _glowBorderCtr = 0;
|
|
|
6493
6501
|
var BOX_H = 110;
|
|
6494
6502
|
var BOX_RX = 25.25;
|
|
6495
6503
|
function SearchBoxGlowBorder() {
|
|
6496
|
-
const [w, setW] = (0,
|
|
6497
|
-
const dashOffset = (0,
|
|
6498
|
-
const gradId = (0,
|
|
6499
|
-
(0,
|
|
6504
|
+
const [w, setW] = (0, import_react33.useState)(0);
|
|
6505
|
+
const dashOffset = (0, import_react33.useRef)(new import_react_native48.Animated.Value(0)).current;
|
|
6506
|
+
const gradId = (0, import_react33.useRef)(`fkSiGlow${++_glowBorderCtr}`).current;
|
|
6507
|
+
(0, import_react33.useEffect)(() => {
|
|
6500
6508
|
if (w === 0) return;
|
|
6501
6509
|
const perim2 = 2 * (w - 2 * BOX_RX) + 2 * (BOX_H - 2 * BOX_RX) + 2 * Math.PI * BOX_RX;
|
|
6502
6510
|
dashOffset.setValue(0);
|
|
6503
|
-
const loop =
|
|
6504
|
-
|
|
6511
|
+
const loop = import_react_native48.Animated.loop(
|
|
6512
|
+
import_react_native48.Animated.timing(dashOffset, { toValue: -perim2, duration: 1600, easing: import_react_native48.Easing.linear, useNativeDriver: false })
|
|
6505
6513
|
);
|
|
6506
6514
|
loop.start();
|
|
6507
6515
|
return () => loop.stop();
|
|
6508
6516
|
}, [w, dashOffset]);
|
|
6509
6517
|
const perim = w > 0 ? 2 * (w - 2 * BOX_RX) + 2 * (BOX_H - 2 * BOX_RX) + 2 * Math.PI * BOX_RX : 0;
|
|
6510
6518
|
const segLen = perim * 0.16;
|
|
6511
|
-
return /* @__PURE__ */ (0,
|
|
6512
|
-
|
|
6519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6520
|
+
import_react_native48.View,
|
|
6513
6521
|
{
|
|
6514
|
-
style: [
|
|
6522
|
+
style: [import_react_native48.StyleSheet.absoluteFill, { borderRadius: 26 }],
|
|
6515
6523
|
pointerEvents: "none",
|
|
6516
6524
|
onLayout: (e) => setW(e.nativeEvent.layout.width),
|
|
6517
|
-
children: w > 0 && /* @__PURE__ */ (0,
|
|
6518
|
-
/* @__PURE__ */ (0,
|
|
6519
|
-
/* @__PURE__ */ (0,
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6521
|
-
/* @__PURE__ */ (0,
|
|
6525
|
+
children: w > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native_svg5.default, { width: w, height: BOX_H, style: import_react_native48.StyleSheet.absoluteFill, children: [
|
|
6526
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native_svg5.LinearGradient, { id: gradId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
6527
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Stop, { offset: "0", stopColor: "#3f7ee2" }),
|
|
6528
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Stop, { offset: "0.55", stopColor: "#7b5cff" }),
|
|
6529
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native_svg5.Stop, { offset: "1", stopColor: "#37e0e6" })
|
|
6522
6530
|
] }) }),
|
|
6523
|
-
/* @__PURE__ */ (0,
|
|
6531
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6524
6532
|
import_react_native_svg5.Rect,
|
|
6525
6533
|
{
|
|
6526
6534
|
x: 0.75,
|
|
@@ -6535,7 +6543,7 @@ function SearchBoxGlowBorder() {
|
|
|
6535
6543
|
opacity: 1
|
|
6536
6544
|
}
|
|
6537
6545
|
),
|
|
6538
|
-
/* @__PURE__ */ (0,
|
|
6546
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
6539
6547
|
AnimatedRect,
|
|
6540
6548
|
{
|
|
6541
6549
|
x: 0.75,
|
|
@@ -6558,51 +6566,51 @@ function SearchBoxGlowBorder() {
|
|
|
6558
6566
|
}
|
|
6559
6567
|
function LatestRow({ thread, onPress }) {
|
|
6560
6568
|
const { tokens } = useTheme();
|
|
6561
|
-
return /* @__PURE__ */ (0,
|
|
6562
|
-
/* @__PURE__ */ (0,
|
|
6563
|
-
/* @__PURE__ */ (0,
|
|
6564
|
-
/* @__PURE__ */ (0,
|
|
6565
|
-
/* @__PURE__ */ (0,
|
|
6569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Pressable, { onPress, style: styles40.latestRow, children: [
|
|
6570
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles40.rowHead, children: [
|
|
6571
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Avatar, { authorId: thread.authorId, author: thread.authorDisplayName ?? "Unknown", avatarUrl: thread.authorAvatarUrl ?? null, size: 18 }),
|
|
6572
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.rowAuthor, { color: tokens["text-2"] }], children: thread.authorDisplayName ?? "Unknown" }),
|
|
6573
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Text, { style: [styles40.rowTime, { color: tokens.muted }], children: [
|
|
6566
6574
|
"\xB7 ",
|
|
6567
6575
|
fmtRelativeTime(thread.createdAt)
|
|
6568
6576
|
] })
|
|
6569
6577
|
] }),
|
|
6570
|
-
/* @__PURE__ */ (0,
|
|
6578
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.rowTitle, { color: tokens.text }], numberOfLines: 2, children: thread.title })
|
|
6571
6579
|
] });
|
|
6572
6580
|
}
|
|
6573
6581
|
function LiveThreadRow({ r, onPress }) {
|
|
6574
6582
|
const { tokens } = useTheme();
|
|
6575
|
-
return /* @__PURE__ */ (0,
|
|
6576
|
-
/* @__PURE__ */ (0,
|
|
6577
|
-
/* @__PURE__ */ (0,
|
|
6578
|
-
/* @__PURE__ */ (0,
|
|
6579
|
-
/* @__PURE__ */ (0,
|
|
6583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Pressable, { onPress, style: [styles40.row, { borderBottomColor: tokens.border }], children: [
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles40.rowHead, children: [
|
|
6585
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Avatar, { authorId: r.authorId, author: r.authorDisplayName, avatarUrl: r.authorAvatarUrl, size: 18 }),
|
|
6586
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.rowAuthor, { color: tokens["text-2"] }], children: r.authorDisplayName }),
|
|
6587
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Text, { style: [styles40.rowTime, { color: tokens.muted }], children: [
|
|
6580
6588
|
"\xB7 ",
|
|
6581
6589
|
fmtRelativeTime(r.createdAt)
|
|
6582
6590
|
] })
|
|
6583
6591
|
] }),
|
|
6584
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.rowTitle, { color: tokens.text }], numberOfLines: 2, children: r.title })
|
|
6585
6593
|
] });
|
|
6586
6594
|
}
|
|
6587
6595
|
function LiveCommentRow({ r, onPress }) {
|
|
6588
6596
|
const { tokens } = useTheme();
|
|
6589
|
-
return /* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
6592
|
-
/* @__PURE__ */ (0,
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Pressable, { onPress, style: [styles40.row, { borderBottomColor: tokens.border }], children: [
|
|
6598
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles40.rowHead, children: [
|
|
6599
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Avatar, { authorId: r.authorId, author: r.authorDisplayName, avatarUrl: r.authorAvatarUrl, size: 18 }),
|
|
6600
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.rowAuthor, { color: tokens["text-2"] }], children: r.authorDisplayName }),
|
|
6601
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Text, { style: [styles40.rowTime, { color: tokens.muted }], children: [
|
|
6594
6602
|
"\xB7 ",
|
|
6595
6603
|
fmtRelativeTime(r.createdAt)
|
|
6596
6604
|
] })
|
|
6597
6605
|
] }),
|
|
6598
|
-
/* @__PURE__ */ (0,
|
|
6599
|
-
/* @__PURE__ */ (0,
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles40.rowSnippet, { color: tokens["text-2"] }], numberOfLines: 2, children: r.bodySnippet }),
|
|
6607
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.Text, { style: [styles40.rowMeta, { color: tokens.muted }], numberOfLines: 1, children: [
|
|
6600
6608
|
"in: ",
|
|
6601
6609
|
r.threadTitle
|
|
6602
6610
|
] })
|
|
6603
6611
|
] });
|
|
6604
6612
|
}
|
|
6605
|
-
var
|
|
6613
|
+
var styles40 = import_react_native48.StyleSheet.create({
|
|
6606
6614
|
root: { flex: 1 },
|
|
6607
6615
|
searchBox: {
|
|
6608
6616
|
marginHorizontal: 14,
|
|
@@ -6694,7 +6702,7 @@ var styles39 = import_react_native47.StyleSheet.create({
|
|
|
6694
6702
|
row: {
|
|
6695
6703
|
paddingHorizontal: 16,
|
|
6696
6704
|
paddingVertical: 12,
|
|
6697
|
-
borderBottomWidth:
|
|
6705
|
+
borderBottomWidth: import_react_native48.StyleSheet.hairlineWidth
|
|
6698
6706
|
},
|
|
6699
6707
|
latestRow: {
|
|
6700
6708
|
paddingHorizontal: 16,
|
|
@@ -6744,11 +6752,11 @@ var styles39 = import_react_native47.StyleSheet.create({
|
|
|
6744
6752
|
});
|
|
6745
6753
|
|
|
6746
6754
|
// src/screens/AskResultScreen.tsx
|
|
6747
|
-
var
|
|
6748
|
-
var
|
|
6755
|
+
var import_react34 = require("react");
|
|
6756
|
+
var import_react_native49 = require("react-native");
|
|
6749
6757
|
var import_react_native_safe_area_context10 = require("react-native-safe-area-context");
|
|
6750
6758
|
var import_native9 = require("@react-navigation/native");
|
|
6751
|
-
var
|
|
6759
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
6752
6760
|
function AskResultScreen() {
|
|
6753
6761
|
const { tokens, mode } = useTheme();
|
|
6754
6762
|
const insets = (0, import_react_native_safe_area_context10.useSafeAreaInsets)();
|
|
@@ -6757,11 +6765,11 @@ function AskResultScreen() {
|
|
|
6757
6765
|
const session = useSession();
|
|
6758
6766
|
const { apiUrl, forumId } = session;
|
|
6759
6767
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
6760
|
-
const [turns, setTurns] = (0,
|
|
6761
|
-
const [followUp, setFollowUp] = (0,
|
|
6762
|
-
const [sheetTurn, setSheetTurn] = (0,
|
|
6763
|
-
const scrollRef = (0,
|
|
6764
|
-
const ask = (0,
|
|
6768
|
+
const [turns, setTurns] = (0, import_react34.useState)([]);
|
|
6769
|
+
const [followUp, setFollowUp] = (0, import_react34.useState)("");
|
|
6770
|
+
const [sheetTurn, setSheetTurn] = (0, import_react34.useState)(null);
|
|
6771
|
+
const scrollRef = (0, import_react34.useRef)(null);
|
|
6772
|
+
const ask = (0, import_react34.useCallback)(async (q) => {
|
|
6765
6773
|
if (!token) return;
|
|
6766
6774
|
const idx = turns.length;
|
|
6767
6775
|
setTurns((prev) => [...prev, { query: q, answer: null, sources: [], loading: true, error: null }]);
|
|
@@ -6802,10 +6810,10 @@ function AskResultScreen() {
|
|
|
6802
6810
|
setTurns((prev) => prev.map((t, i) => i === idx ? { ...t, loading: false, error: msg } : t));
|
|
6803
6811
|
}
|
|
6804
6812
|
}, [apiUrl, forumId, token, turns.length]);
|
|
6805
|
-
(0,
|
|
6813
|
+
(0, import_react34.useEffect)(() => {
|
|
6806
6814
|
void ask(route.params.query);
|
|
6807
6815
|
}, []);
|
|
6808
|
-
(0,
|
|
6816
|
+
(0, import_react34.useEffect)(() => {
|
|
6809
6817
|
setTimeout(() => scrollRef.current?.scrollToEnd({ animated: true }), 80);
|
|
6810
6818
|
}, [turns]);
|
|
6811
6819
|
function submitFollowUp() {
|
|
@@ -6817,21 +6825,21 @@ function AskResultScreen() {
|
|
|
6817
6825
|
function handleSuggest(p) {
|
|
6818
6826
|
void ask(p);
|
|
6819
6827
|
}
|
|
6820
|
-
return /* @__PURE__ */ (0,
|
|
6821
|
-
/* @__PURE__ */ (0,
|
|
6822
|
-
/* @__PURE__ */ (0,
|
|
6823
|
-
/* @__PURE__ */ (0,
|
|
6824
|
-
/* @__PURE__ */ (0,
|
|
6828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: [styles41.root, { backgroundColor: tokens.bg }], children: [
|
|
6829
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: { height: insets.top + (import_react_native49.Platform.OS === "android" ? 12 : 0) } }),
|
|
6830
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.header, children: [
|
|
6831
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Pressable, { onPress: () => navigation.goBack(), hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: { transform: [{ scaleX: -1 }] }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ArrowRightIcon, { size: 20, color: tokens.text }) }) }),
|
|
6832
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.headerTitle, { color: tokens.text }], children: "Ask AI" })
|
|
6825
6833
|
] }),
|
|
6826
|
-
/* @__PURE__ */ (0,
|
|
6827
|
-
/* @__PURE__ */ (0,
|
|
6828
|
-
|
|
6834
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.KeyboardAvoidingView, { behavior: import_react_native49.Platform.OS === "ios" ? "padding" : void 0, style: { flex: 1 }, children: [
|
|
6835
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6836
|
+
import_react_native49.ScrollView,
|
|
6829
6837
|
{
|
|
6830
6838
|
ref: scrollRef,
|
|
6831
6839
|
keyboardShouldPersistTaps: "handled",
|
|
6832
6840
|
keyboardDismissMode: "on-drag",
|
|
6833
|
-
contentContainerStyle: [
|
|
6834
|
-
children: turns.map((turn, i) => /* @__PURE__ */ (0,
|
|
6841
|
+
contentContainerStyle: [styles41.body, { paddingBottom: 20 }],
|
|
6842
|
+
children: turns.map((turn, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6835
6843
|
TurnView,
|
|
6836
6844
|
{
|
|
6837
6845
|
turn,
|
|
@@ -6845,13 +6853,13 @@ function AskResultScreen() {
|
|
|
6845
6853
|
))
|
|
6846
6854
|
}
|
|
6847
6855
|
),
|
|
6848
|
-
/* @__PURE__ */ (0,
|
|
6856
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: [styles41.inputBar, {
|
|
6849
6857
|
backgroundColor: mode === "dark" ? tokens.surface : "#dde1e6",
|
|
6850
6858
|
marginHorizontal: 14,
|
|
6851
6859
|
marginBottom: insets.bottom + 12
|
|
6852
6860
|
}], children: [
|
|
6853
|
-
/* @__PURE__ */ (0,
|
|
6854
|
-
|
|
6861
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6862
|
+
import_react_native49.TextInput,
|
|
6855
6863
|
{
|
|
6856
6864
|
value: followUp,
|
|
6857
6865
|
onChangeText: setFollowUp,
|
|
@@ -6859,57 +6867,45 @@ function AskResultScreen() {
|
|
|
6859
6867
|
returnKeyType: "send",
|
|
6860
6868
|
placeholder: "Ask a follow-up\u2026",
|
|
6861
6869
|
placeholderTextColor: tokens.faint,
|
|
6862
|
-
style: [
|
|
6870
|
+
style: [styles41.followInput, { color: tokens.text }]
|
|
6863
6871
|
}
|
|
6864
6872
|
),
|
|
6865
|
-
/* @__PURE__ */ (0,
|
|
6866
|
-
|
|
6873
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6874
|
+
import_react_native49.Pressable,
|
|
6867
6875
|
{
|
|
6868
|
-
style: [
|
|
6876
|
+
style: [styles41.followBtn, {
|
|
6869
6877
|
backgroundColor: tokens.accent,
|
|
6870
6878
|
opacity: followUp.trim() ? 1 : 0.35
|
|
6871
6879
|
}],
|
|
6872
6880
|
onPress: submitFollowUp,
|
|
6873
6881
|
hitSlop: 6,
|
|
6874
|
-
children: /* @__PURE__ */ (0,
|
|
6882
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChevronRightIcon, { size: 16, color: "#fff" })
|
|
6875
6883
|
}
|
|
6876
6884
|
)
|
|
6877
6885
|
] })
|
|
6878
6886
|
] }),
|
|
6879
|
-
/* @__PURE__ */ (0,
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
children: [
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
tokens,
|
|
6902
|
-
onPress: () => {
|
|
6903
|
-
setSheetTurn(null);
|
|
6904
|
-
navigation.navigate("Thread", { threadId: src.threadId });
|
|
6905
|
-
}
|
|
6906
|
-
},
|
|
6907
|
-
src.threadId + i
|
|
6908
|
-
)) })
|
|
6909
|
-
] })
|
|
6910
|
-
]
|
|
6911
|
-
}
|
|
6912
|
-
)
|
|
6887
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BottomSheetShell, { visible: sheetTurn !== null, onClose: () => setSheetTurn(null), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: [styles41.sheet, {
|
|
6888
|
+
backgroundColor: tokens.bg,
|
|
6889
|
+
paddingBottom: insets.bottom + 16
|
|
6890
|
+
}], children: [
|
|
6891
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: styles41.sheetHandle }),
|
|
6892
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.sheetHeader, children: [
|
|
6893
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.sheetTitle, { color: tokens.text }], children: "Sources" }),
|
|
6894
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Pressable, { onPress: () => setSheetTurn(null), hitSlop: 8, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.sheetClose, { color: tokens.muted }], children: "\u2715" }) })
|
|
6895
|
+
] }),
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.ScrollView, { contentContainerStyle: { paddingVertical: 8 }, children: (sheetTurn?.sources ?? []).map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6897
|
+
SourceCard,
|
|
6898
|
+
{
|
|
6899
|
+
src,
|
|
6900
|
+
tokens,
|
|
6901
|
+
onPress: () => {
|
|
6902
|
+
setSheetTurn(null);
|
|
6903
|
+
navigation.navigate("Thread", { threadId: src.threadId });
|
|
6904
|
+
}
|
|
6905
|
+
},
|
|
6906
|
+
src.threadId + i
|
|
6907
|
+
)) })
|
|
6908
|
+
] }) })
|
|
6913
6909
|
] });
|
|
6914
6910
|
}
|
|
6915
6911
|
function TurnView({
|
|
@@ -6921,62 +6917,62 @@ function TurnView({
|
|
|
6921
6917
|
isLast
|
|
6922
6918
|
}) {
|
|
6923
6919
|
const mediaSources = turn.sources.filter((s) => s.imageUrl);
|
|
6924
|
-
return /* @__PURE__ */ (0,
|
|
6925
|
-
/* @__PURE__ */ (0,
|
|
6926
|
-
/* @__PURE__ */ (0,
|
|
6927
|
-
turn.loading && !turn.answer && /* @__PURE__ */ (0,
|
|
6928
|
-
turn.error && /* @__PURE__ */ (0,
|
|
6929
|
-
(turn.answer || turn.sources.length > 0) && !turn.error && /* @__PURE__ */ (0,
|
|
6930
|
-
turn.sources.length > 0 && /* @__PURE__ */ (0,
|
|
6931
|
-
|
|
6920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.turn, children: [
|
|
6921
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: styles41.queryRow, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: [styles41.queryPill, { backgroundColor: tokens["surface-2"] }], children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.queryText, { color: tokens.text }], children: turn.query }) }) }),
|
|
6922
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.responseWrap, children: [
|
|
6923
|
+
turn.loading && !turn.answer && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.ActivityIndicator, { color: tokens.accent, style: { marginTop: 12 } }),
|
|
6924
|
+
turn.error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.errorText, { color: tokens.up }], children: turn.error }),
|
|
6925
|
+
(turn.answer || turn.sources.length > 0) && !turn.error && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.answerWrap, children: [
|
|
6926
|
+
turn.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
6927
|
+
import_react_native49.Pressable,
|
|
6932
6928
|
{
|
|
6933
|
-
style: [
|
|
6929
|
+
style: [styles41.sourcePill, { borderColor: tokens.border, backgroundColor: tokens["surface-2"] }],
|
|
6934
6930
|
onPress: onSourcesPress,
|
|
6935
6931
|
children: [
|
|
6936
|
-
/* @__PURE__ */ (0,
|
|
6937
|
-
/* @__PURE__ */ (0,
|
|
6938
|
-
/* @__PURE__ */ (0,
|
|
6932
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AvatarStack, { sources: turn.sources }),
|
|
6933
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.sourcePillText, { color: tokens["text-2"] }], numberOfLines: 1, children: "From " + truncate(turn.sources[0]?.title ?? "", 28) + (turn.sources.length > 1 ? ` +${turn.sources.length - 1} more` : "") }),
|
|
6934
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChevronRightIcon, { size: 12, color: tokens.muted })
|
|
6939
6935
|
]
|
|
6940
6936
|
}
|
|
6941
6937
|
),
|
|
6942
|
-
turn.answer?.intro ? /* @__PURE__ */ (0,
|
|
6943
|
-
(turn.answer?.categories ?? []).map((cat, ci) => /* @__PURE__ */ (0,
|
|
6944
|
-
/* @__PURE__ */ (0,
|
|
6938
|
+
turn.answer?.intro ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.intro, { color: tokens.text }], children: turn.answer.intro }) : turn.loading ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.ActivityIndicator, { color: tokens.accent, style: { marginVertical: 10 }, size: "small" }) : null,
|
|
6939
|
+
(turn.answer?.categories ?? []).map((cat, ci) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.category, children: [
|
|
6940
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.catTitle, { color: tokens["text-2"] }], children: cat.title }),
|
|
6945
6941
|
cat.bullets.map((b, bi) => {
|
|
6946
6942
|
const src = turn.sources[b.sourceIndex];
|
|
6947
|
-
return /* @__PURE__ */ (0,
|
|
6948
|
-
/* @__PURE__ */ (0,
|
|
6949
|
-
/* @__PURE__ */ (0,
|
|
6943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.bullet, children: [
|
|
6944
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.bulletFact, { color: tokens.text }], children: b.fact }),
|
|
6945
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.Text, { style: [styles41.bulletQuote, { color: tokens.accent }], children: [
|
|
6950
6946
|
'"',
|
|
6951
6947
|
b.quote,
|
|
6952
6948
|
'"'
|
|
6953
6949
|
] }),
|
|
6954
|
-
src && /* @__PURE__ */ (0,
|
|
6955
|
-
|
|
6950
|
+
src && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
6951
|
+
import_react_native49.Pressable,
|
|
6956
6952
|
{
|
|
6957
|
-
style: [
|
|
6953
|
+
style: [styles41.attrChip, { backgroundColor: tokens["surface-2"] }],
|
|
6958
6954
|
onPress: () => onThreadPress(src.threadId),
|
|
6959
6955
|
children: [
|
|
6960
|
-
/* @__PURE__ */ (0,
|
|
6961
|
-
/* @__PURE__ */ (0,
|
|
6956
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.attrText, { color: tokens["text-2"] }], numberOfLines: 1, children: truncate(src.title, 40) }),
|
|
6957
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChevronRightIcon, { size: 10, color: tokens.muted })
|
|
6962
6958
|
]
|
|
6963
6959
|
}
|
|
6964
6960
|
)
|
|
6965
6961
|
] }, bi);
|
|
6966
6962
|
})
|
|
6967
6963
|
] }, ci)),
|
|
6968
|
-
!turn.loading && mediaSources.length > 0 && /* @__PURE__ */ (0,
|
|
6969
|
-
/* @__PURE__ */ (0,
|
|
6970
|
-
/* @__PURE__ */ (0,
|
|
6971
|
-
|
|
6964
|
+
!turn.loading && mediaSources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.mediaSection, children: [
|
|
6965
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.catTitle, { color: tokens["text-2"] }], children: "Related Media" }),
|
|
6966
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles41.mediaScroll, children: mediaSources.map((src) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6967
|
+
import_react_native49.Pressable,
|
|
6972
6968
|
{
|
|
6973
|
-
style: [
|
|
6969
|
+
style: [styles41.mediaThumbnail, { borderColor: tokens.border }],
|
|
6974
6970
|
onPress: () => onThreadPress(src.threadId),
|
|
6975
|
-
children: /* @__PURE__ */ (0,
|
|
6976
|
-
|
|
6971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6972
|
+
import_react_native49.Image,
|
|
6977
6973
|
{
|
|
6978
6974
|
source: { uri: src.imageUrl },
|
|
6979
|
-
style:
|
|
6975
|
+
style: styles41.mediaImage,
|
|
6980
6976
|
resizeMode: "cover"
|
|
6981
6977
|
}
|
|
6982
6978
|
)
|
|
@@ -6984,13 +6980,13 @@ function TurnView({
|
|
|
6984
6980
|
src.threadId
|
|
6985
6981
|
)) })
|
|
6986
6982
|
] }),
|
|
6987
|
-
isLast && !turn.loading && turn.answer && /* @__PURE__ */ (0,
|
|
6988
|
-
!turn.loading && (turn.answer?.suggestions.length ?? 0) > 0 && /* @__PURE__ */ (0,
|
|
6989
|
-
|
|
6983
|
+
isLast && !turn.loading && turn.answer && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.disclaimer, { color: tokens.muted }], children: "Responses are AI-generated from threads and comments and may not be accurate." }),
|
|
6984
|
+
!turn.loading && (turn.answer?.suggestions.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles41.suggestionRow, children: turn.answer.suggestions.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
6985
|
+
import_react_native49.Pressable,
|
|
6990
6986
|
{
|
|
6991
|
-
style: [
|
|
6987
|
+
style: [styles41.suggestionChip, { borderColor: tokens.accent }],
|
|
6992
6988
|
onPress: () => onSuggest(p),
|
|
6993
|
-
children: /* @__PURE__ */ (0,
|
|
6989
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.suggestionText, { color: tokens.accent }], children: p })
|
|
6994
6990
|
},
|
|
6995
6991
|
i
|
|
6996
6992
|
)) })
|
|
@@ -7000,7 +6996,7 @@ function TurnView({
|
|
|
7000
6996
|
}
|
|
7001
6997
|
function AvatarStack({ sources }) {
|
|
7002
6998
|
const shown = sources.slice(0, 3);
|
|
7003
|
-
return /* @__PURE__ */ (0,
|
|
6999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: styles41.avatarStack, children: shown.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: [styles41.avatarWrap, { zIndex: 3 - i, marginLeft: i === 0 ? 0 : -8 }], children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7004
7000
|
Avatar,
|
|
7005
7001
|
{
|
|
7006
7002
|
authorId: s.authorId,
|
|
@@ -7015,13 +7011,13 @@ function SourceCard({
|
|
|
7015
7011
|
tokens,
|
|
7016
7012
|
onPress
|
|
7017
7013
|
}) {
|
|
7018
|
-
return /* @__PURE__ */ (0,
|
|
7019
|
-
|
|
7014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
7015
|
+
import_react_native49.Pressable,
|
|
7020
7016
|
{
|
|
7021
|
-
style: [
|
|
7017
|
+
style: [styles41.sourceCard, { backgroundColor: tokens["surface-2"] }],
|
|
7022
7018
|
onPress,
|
|
7023
7019
|
children: [
|
|
7024
|
-
/* @__PURE__ */ (0,
|
|
7020
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7025
7021
|
Avatar,
|
|
7026
7022
|
{
|
|
7027
7023
|
authorId: src.authorId,
|
|
@@ -7030,9 +7026,9 @@ function SourceCard({
|
|
|
7030
7026
|
size: 36
|
|
7031
7027
|
}
|
|
7032
7028
|
),
|
|
7033
|
-
/* @__PURE__ */ (0,
|
|
7034
|
-
/* @__PURE__ */ (0,
|
|
7035
|
-
/* @__PURE__ */ (0,
|
|
7029
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles41.sourceCardBody, children: [
|
|
7030
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles41.sourceCardTitle, { color: tokens.text }], numberOfLines: 2, children: src.title }),
|
|
7031
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.Text, { style: [styles41.sourceCardMeta, { color: tokens.muted }], children: [
|
|
7036
7032
|
src.authorDisplayName,
|
|
7037
7033
|
" \xB7 ",
|
|
7038
7034
|
fmtRelativeTime(src.createdAt),
|
|
@@ -7048,7 +7044,7 @@ function SourceCard({
|
|
|
7048
7044
|
function truncate(s, max) {
|
|
7049
7045
|
return s.length > max ? s.slice(0, max) + "\u2026" : s;
|
|
7050
7046
|
}
|
|
7051
|
-
var
|
|
7047
|
+
var styles41 = import_react_native49.StyleSheet.create({
|
|
7052
7048
|
root: { flex: 1 },
|
|
7053
7049
|
header: {
|
|
7054
7050
|
flexDirection: "row",
|
|
@@ -7093,7 +7089,7 @@ var styles40 = import_react_native48.StyleSheet.create({
|
|
|
7093
7089
|
flexDirection: "row",
|
|
7094
7090
|
alignItems: "center",
|
|
7095
7091
|
gap: 6,
|
|
7096
|
-
borderWidth:
|
|
7092
|
+
borderWidth: import_react_native49.StyleSheet.hairlineWidth,
|
|
7097
7093
|
borderRadius: 20,
|
|
7098
7094
|
paddingHorizontal: 10,
|
|
7099
7095
|
paddingVertical: 6,
|
|
@@ -7172,7 +7168,7 @@ var styles40 = import_react_native48.StyleSheet.create({
|
|
|
7172
7168
|
borderRadius: 12,
|
|
7173
7169
|
marginRight: 8,
|
|
7174
7170
|
overflow: "hidden",
|
|
7175
|
-
borderWidth:
|
|
7171
|
+
borderWidth: import_react_native49.StyleSheet.hairlineWidth
|
|
7176
7172
|
},
|
|
7177
7173
|
mediaImage: {
|
|
7178
7174
|
width: 120,
|
|
@@ -7210,10 +7206,6 @@ var styles40 = import_react_native48.StyleSheet.create({
|
|
|
7210
7206
|
justifyContent: "center"
|
|
7211
7207
|
},
|
|
7212
7208
|
// Sources bottom sheet
|
|
7213
|
-
sheetBackdrop: {
|
|
7214
|
-
flex: 1,
|
|
7215
|
-
backgroundColor: "rgba(0,0,0,0.4)"
|
|
7216
|
-
},
|
|
7217
7209
|
sheet: {
|
|
7218
7210
|
borderRadius: 20,
|
|
7219
7211
|
paddingTop: 12,
|
|
@@ -7283,10 +7275,10 @@ var styles40 = import_react_native48.StyleSheet.create({
|
|
|
7283
7275
|
});
|
|
7284
7276
|
|
|
7285
7277
|
// src/screens/ModerationScreen.tsx
|
|
7286
|
-
var
|
|
7287
|
-
var
|
|
7278
|
+
var import_react35 = require("react");
|
|
7279
|
+
var import_react_native50 = require("react-native");
|
|
7288
7280
|
var import_native10 = require("@react-navigation/native");
|
|
7289
|
-
var
|
|
7281
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7290
7282
|
var PAGE_LIMIT = 50;
|
|
7291
7283
|
function badgeFor2(item) {
|
|
7292
7284
|
if (item.reporterId) return { label: "Reported", Icon: ReportIcon, color: "#ef4444" };
|
|
@@ -7299,11 +7291,11 @@ function ModerationBody() {
|
|
|
7299
7291
|
const onScroll = useScrollCollapse();
|
|
7300
7292
|
const { apiUrl } = session;
|
|
7301
7293
|
const token = session.status === "ready" ? session.sessionToken : void 0;
|
|
7302
|
-
const [items, setItems] = (0,
|
|
7303
|
-
const [loading, setLoading] = (0,
|
|
7304
|
-
const [error, setError] = (0,
|
|
7305
|
-
const [resolvingId, setResolvingId] = (0,
|
|
7306
|
-
(0,
|
|
7294
|
+
const [items, setItems] = (0, import_react35.useState)([]);
|
|
7295
|
+
const [loading, setLoading] = (0, import_react35.useState)(true);
|
|
7296
|
+
const [error, setError] = (0, import_react35.useState)(null);
|
|
7297
|
+
const [resolvingId, setResolvingId] = (0, import_react35.useState)(null);
|
|
7298
|
+
(0, import_react35.useEffect)(() => {
|
|
7307
7299
|
if (!token) return;
|
|
7308
7300
|
let cancelled = false;
|
|
7309
7301
|
setLoading(true);
|
|
@@ -7329,11 +7321,11 @@ function ModerationBody() {
|
|
|
7329
7321
|
setResolvingId(null);
|
|
7330
7322
|
}
|
|
7331
7323
|
}
|
|
7332
|
-
return /* @__PURE__ */ (0,
|
|
7333
|
-
/* @__PURE__ */ (0,
|
|
7334
|
-
/* @__PURE__ */ (0,
|
|
7335
|
-
loading ? /* @__PURE__ */ (0,
|
|
7336
|
-
|
|
7324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native50.View, { style: styles42.content, children: [
|
|
7325
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BackRow, { onPress: () => navigation.goBack() }),
|
|
7326
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.Text, { style: [styles42.heading, { color: tokens.text }], children: "Moderation" }),
|
|
7327
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.View, { style: styles42.center, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Mascot, { size: 32 }) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.View, { style: styles42.center, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.Text, { style: { color: tokens["text-2"] }, children: error }) }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.View, { style: styles42.center, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.Text, { style: { color: tokens["text-2"] }, children: "Nothing pending review" }) }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
7328
|
+
import_react_native50.FlatList,
|
|
7337
7329
|
{
|
|
7338
7330
|
data: items,
|
|
7339
7331
|
keyExtractor: (i) => i.id,
|
|
@@ -7342,42 +7334,42 @@ function ModerationBody() {
|
|
|
7342
7334
|
renderItem: ({ item, index }) => {
|
|
7343
7335
|
const badge = badgeFor2(item);
|
|
7344
7336
|
const resolving = resolvingId === item.id;
|
|
7345
|
-
return /* @__PURE__ */ (0,
|
|
7346
|
-
|
|
7337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
7338
|
+
import_react_native50.Pressable,
|
|
7347
7339
|
{
|
|
7348
7340
|
onPress: () => {
|
|
7349
7341
|
if (item.threadId) navigation.navigate("Thread", { threadId: item.threadId });
|
|
7350
7342
|
},
|
|
7351
|
-
style: [
|
|
7343
|
+
style: [styles42.row, index > 0 && { borderTopWidth: 1, borderTopColor: tokens.border }],
|
|
7352
7344
|
children: [
|
|
7353
|
-
/* @__PURE__ */ (0,
|
|
7354
|
-
/* @__PURE__ */ (0,
|
|
7355
|
-
/* @__PURE__ */ (0,
|
|
7345
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.View, { style: styles42.rowTop, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native50.View, { style: [styles42.badge, { backgroundColor: `${badge.color}30` }], children: [
|
|
7346
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(badge.Icon, { size: 12, color: badge.color }),
|
|
7347
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.Text, { style: [styles42.badgeLabel, { color: badge.color }], children: badge.label })
|
|
7356
7348
|
] }) }),
|
|
7357
|
-
/* @__PURE__ */ (0,
|
|
7358
|
-
/* @__PURE__ */ (0,
|
|
7359
|
-
item.reason ? /* @__PURE__ */ (0,
|
|
7349
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.Text, { style: [styles42.threadTitle, { color: tokens.text }], numberOfLines: 1, children: item.threadTitle ?? "Untitled thread" }),
|
|
7350
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native50.Text, { style: [styles42.body, { color: tokens["text-2"] }], numberOfLines: 2, children: item.commentBody ?? "The thread itself was reported." }),
|
|
7351
|
+
item.reason ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native50.Text, { style: [styles42.reason, { color: tokens.muted }], numberOfLines: 1, children: [
|
|
7360
7352
|
"\u201C",
|
|
7361
7353
|
item.reason,
|
|
7362
7354
|
"\u201D"
|
|
7363
7355
|
] }) : null,
|
|
7364
|
-
/* @__PURE__ */ (0,
|
|
7365
|
-
/* @__PURE__ */ (0,
|
|
7366
|
-
|
|
7356
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native50.View, { style: styles42.actions, children: [
|
|
7357
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
7358
|
+
import_react_native50.Pressable,
|
|
7367
7359
|
{
|
|
7368
7360
|
disabled: resolving,
|
|
7369
7361
|
onPress: () => handleResolve(item, "approved"),
|
|
7370
|
-
style: [
|
|
7371
|
-
children: /* @__PURE__ */ (0,
|
|
7362
|
+
style: [styles42.actionBtn, { backgroundColor: "rgba(46,193,106,0.18)" }, resolving && styles42.actionDisabled],
|
|
7363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CheckIcon, { size: 16, color: "#2ec16a" })
|
|
7372
7364
|
}
|
|
7373
7365
|
),
|
|
7374
|
-
/* @__PURE__ */ (0,
|
|
7375
|
-
|
|
7366
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
7367
|
+
import_react_native50.Pressable,
|
|
7376
7368
|
{
|
|
7377
7369
|
disabled: resolving,
|
|
7378
7370
|
onPress: () => handleResolve(item, "removed"),
|
|
7379
|
-
style: [
|
|
7380
|
-
children: /* @__PURE__ */ (0,
|
|
7371
|
+
style: [styles42.actionBtn, { backgroundColor: "rgba(239,68,68,0.18)" }, resolving && styles42.actionDisabled],
|
|
7372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CloseIcon, { size: 16, color: "#ef4444" })
|
|
7381
7373
|
}
|
|
7382
7374
|
)
|
|
7383
7375
|
] })
|
|
@@ -7391,9 +7383,9 @@ function ModerationBody() {
|
|
|
7391
7383
|
] });
|
|
7392
7384
|
}
|
|
7393
7385
|
function ModerationScreen() {
|
|
7394
|
-
return /* @__PURE__ */ (0,
|
|
7386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ModerationBody, {}) });
|
|
7395
7387
|
}
|
|
7396
|
-
var
|
|
7388
|
+
var styles42 = import_react_native50.StyleSheet.create({
|
|
7397
7389
|
content: { flex: 1, paddingHorizontal: 16, paddingTop: 12 },
|
|
7398
7390
|
heading: { fontSize: 17, fontWeight: "800", marginTop: 12, marginBottom: 8 },
|
|
7399
7391
|
center: { alignItems: "center", marginTop: 40 },
|
|
@@ -7410,11 +7402,11 @@ var styles41 = import_react_native49.StyleSheet.create({
|
|
|
7410
7402
|
});
|
|
7411
7403
|
|
|
7412
7404
|
// src/navigation/RootNavigator.tsx
|
|
7413
|
-
var
|
|
7405
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7414
7406
|
var Stack = (0, import_native_stack.createNativeStackNavigator)();
|
|
7415
7407
|
function RootNavigator() {
|
|
7416
7408
|
const { tokens, mode } = useTheme();
|
|
7417
|
-
const navTheme = (0,
|
|
7409
|
+
const navTheme = (0, import_react36.useMemo)(() => ({
|
|
7418
7410
|
...mode === "dark" ? import_native11.DarkTheme : import_native11.DefaultTheme,
|
|
7419
7411
|
colors: {
|
|
7420
7412
|
...mode === "dark" ? import_native11.DarkTheme.colors : import_native11.DefaultTheme.colors,
|
|
@@ -7426,20 +7418,20 @@ function RootNavigator() {
|
|
|
7426
7418
|
}
|
|
7427
7419
|
}), [mode, tokens]);
|
|
7428
7420
|
const containerProps = { theme: navTheme, independent: true };
|
|
7429
|
-
const container = /* @__PURE__ */ (0,
|
|
7430
|
-
/* @__PURE__ */ (0,
|
|
7431
|
-
/* @__PURE__ */ (0,
|
|
7432
|
-
/* @__PURE__ */ (0,
|
|
7433
|
-
/* @__PURE__ */ (0,
|
|
7434
|
-
/* @__PURE__ */ (0,
|
|
7435
|
-
/* @__PURE__ */ (0,
|
|
7436
|
-
/* @__PURE__ */ (0,
|
|
7421
|
+
const container = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_native11.NavigationContainer, { ...containerProps, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Stack.Navigator, { screenOptions: { headerShown: false, statusBarTranslucent: true }, children: [
|
|
7422
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Stack.Screen, { name: "Feed", component: FeedScreen }),
|
|
7423
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Stack.Screen, { name: "Thread", component: ThreadScreen, options: { animation: "none" } }),
|
|
7424
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Stack.Screen, { name: "Profile", component: ProfileScreen }),
|
|
7425
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Stack.Screen, { name: "Search", component: SearchScreen }),
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Stack.Screen, { name: "SearchInput", component: SearchInputScreen, options: { headerShown: false } }),
|
|
7427
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Stack.Screen, { name: "AskResult", component: AskResultScreen, options: { headerShown: false } }),
|
|
7428
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Stack.Screen, { name: "Moderation", component: ModerationScreen })
|
|
7437
7429
|
] }) });
|
|
7438
|
-
return import_native11.NavigationIndependentTree ? /* @__PURE__ */ (0,
|
|
7430
|
+
return import_native11.NavigationIndependentTree ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_native11.NavigationIndependentTree, { children: container }) : container;
|
|
7439
7431
|
}
|
|
7440
7432
|
|
|
7441
7433
|
// src/ForumKit.tsx
|
|
7442
|
-
var
|
|
7434
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
7443
7435
|
function ForumKit(config) {
|
|
7444
7436
|
const [fontsLoaded] = (0, import_inter.useFonts)({
|
|
7445
7437
|
Inter_400Regular: import_inter.Inter_400Regular,
|
|
@@ -7450,23 +7442,23 @@ function ForumKit(config) {
|
|
|
7450
7442
|
Michroma_400Regular: import_michroma.Michroma_400Regular
|
|
7451
7443
|
});
|
|
7452
7444
|
if (!fontsLoaded) {
|
|
7453
|
-
return /* @__PURE__ */ (0,
|
|
7445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native51.View, { style: { flex: 1, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native51.ActivityIndicator, {}) });
|
|
7454
7446
|
}
|
|
7455
|
-
return /* @__PURE__ */ (0,
|
|
7447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native_safe_area_context11.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ThemeProvider, { theme: config.theme, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SessionProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SessionGate, {}) }) }) });
|
|
7456
7448
|
}
|
|
7457
7449
|
function SessionGate() {
|
|
7458
7450
|
const { tokens } = useTheme();
|
|
7459
7451
|
const session = useSession();
|
|
7460
7452
|
if (session.status === "loading") {
|
|
7461
|
-
return /* @__PURE__ */ (0,
|
|
7453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native51.View, { style: { flex: 1, alignItems: "center", justifyContent: "center", backgroundColor: tokens.bg }, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native51.ActivityIndicator, { color: tokens.accent }) });
|
|
7462
7454
|
}
|
|
7463
7455
|
if (session.status === "error") {
|
|
7464
|
-
return /* @__PURE__ */ (0,
|
|
7465
|
-
/* @__PURE__ */ (0,
|
|
7466
|
-
/* @__PURE__ */ (0,
|
|
7456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_react_native51.View, { style: { flex: 1, alignItems: "center", justifyContent: "center", backgroundColor: tokens.bg, padding: 24 }, children: [
|
|
7457
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native51.Text, { style: { color: tokens.text, fontSize: 15, fontWeight: "600", marginBottom: 6 }, children: "Couldn't connect" }),
|
|
7458
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native51.Text, { style: { color: tokens["text-2"], fontSize: 13, textAlign: "center" }, children: session.error })
|
|
7467
7459
|
] });
|
|
7468
7460
|
}
|
|
7469
|
-
return /* @__PURE__ */ (0,
|
|
7461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RootNavigator, {});
|
|
7470
7462
|
}
|
|
7471
7463
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7472
7464
|
0 && (module.exports = {
|