correction request
This commit is contained in:
@@ -30,7 +30,6 @@ export default function ComposeScreen() {
|
|||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const { client, isConfigured, apiKey, baseUrl } = usePostiz();
|
const { client, isConfigured, apiKey, baseUrl } = usePostiz();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const [content, setContent] = useState("");
|
const [content, setContent] = useState("");
|
||||||
const [selectedChannels, setSelectedChannels] = useState<string[]>([]);
|
const [selectedChannels, setSelectedChannels] = useState<string[]>([]);
|
||||||
const [postNow, setPostNow] = useState(false);
|
const [postNow, setPostNow] = useState(false);
|
||||||
@@ -45,10 +44,10 @@ export default function ComposeScreen() {
|
|||||||
|
|
||||||
const { data: integrations, isLoading: loadingIntegrations } =
|
const { data: integrations, isLoading: loadingIntegrations } =
|
||||||
useQuery<PostizIntegration[]>({
|
useQuery<PostizIntegration[]>({
|
||||||
queryKey: ["integrations"],
|
queryKey: ["integrations", !!client],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!client) return [];
|
if (!client) return [];
|
||||||
const res = await client.get("/integrations");
|
const res = await client.get("integrations");
|
||||||
return Array.isArray(res.data) ? res.data : res.data?.integrations ?? [];
|
return Array.isArray(res.data) ? res.data : res.data?.integrations ?? [];
|
||||||
},
|
},
|
||||||
enabled: !!client,
|
enabled: !!client,
|
||||||
@@ -134,7 +133,7 @@ export default function ComposeScreen() {
|
|||||||
content: [{ content: content.trim(), image: media }],
|
content: [{ content: content.trim(), image: media }],
|
||||||
integrations: selectedChannels,
|
integrations: selectedChannels,
|
||||||
};
|
};
|
||||||
await client.post("/posts", payload);
|
await client.post("posts", payload);
|
||||||
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
"Posted!",
|
"Posted!",
|
||||||
@@ -167,6 +166,7 @@ export default function ComposeScreen() {
|
|||||||
day: "numeric",
|
day: "numeric",
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
});
|
});
|
||||||
|
|
||||||
const formatTimeLabel = (d: Date) =>
|
const formatTimeLabel = (d: Date) =>
|
||||||
d.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" });
|
d.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" });
|
||||||
|
|
||||||
@@ -191,8 +191,7 @@ export default function ComposeScreen() {
|
|||||||
styles.container,
|
styles.container,
|
||||||
{
|
{
|
||||||
paddingTop: Platform.OS === "web" ? 67 : 16,
|
paddingTop: Platform.OS === "web" ? 67 : 16,
|
||||||
paddingBottom:
|
paddingBottom: Platform.OS === "web" ? 100 : insets.bottom + 80,
|
||||||
Platform.OS === "web" ? 100 : insets.bottom + 80,
|
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
bottomOffset={80}
|
bottomOffset={80}
|
||||||
@@ -253,6 +252,7 @@ export default function ComposeScreen() {
|
|||||||
<Text style={[styles.sectionLabel, { color: colors.mutedForeground }]}>
|
<Text style={[styles.sectionLabel, { color: colors.mutedForeground }]}>
|
||||||
CHANNELS
|
CHANNELS
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{loadingIntegrations ? (
|
{loadingIntegrations ? (
|
||||||
<ActivityIndicator color={colors.primary} style={{ marginVertical: 8 }} />
|
<ActivityIndicator color={colors.primary} style={{ marginVertical: 8 }} />
|
||||||
) : (integrations ?? []).length === 0 ? (
|
) : (integrations ?? []).length === 0 ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user