Forum:
Fix: link dari avatar ke forumku & penambahan tombol create di forumku jika id forum milik user yang sama seperti user login ### No issue
This commit is contained in:
@@ -1,25 +1,22 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
AlertCustom,
|
|
||||||
AvatarComp,
|
AvatarComp,
|
||||||
AvatarCustom,
|
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
CenterCustom,
|
CenterCustom,
|
||||||
DrawerCustom,
|
DrawerCustom,
|
||||||
|
FloatingButton,
|
||||||
Grid,
|
Grid,
|
||||||
LoaderCustom,
|
LoaderCustom,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import Forum_BoxDetailSection from "@/screens/Forum/DiscussionBoxSection";
|
import Forum_BoxDetailSection from "@/screens/Forum/DiscussionBoxSection";
|
||||||
import { listDummyDiscussionForum } from "@/screens/Forum/list-data-dummy";
|
|
||||||
import Forum_MenuDrawerBerandaSection from "@/screens/Forum/MenuDrawerSection.tsx/MenuBeranda";
|
import Forum_MenuDrawerBerandaSection from "@/screens/Forum/MenuDrawerSection.tsx/MenuBeranda";
|
||||||
import { apiForumGetAll } from "@/service/api-client/api-forum";
|
import { apiForumGetAll } from "@/service/api-client/api-forum";
|
||||||
import { apiUser } from "@/service/api-client/api-user";
|
import { apiUser } from "@/service/api-client/api-user";
|
||||||
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
@@ -28,9 +25,6 @@ export default function Forumku() {
|
|||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
const [status, setStatus] = useState("");
|
const [status, setStatus] = useState("");
|
||||||
const [alertStatus, setAlertStatus] = useState(false);
|
|
||||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
|
||||||
|
|
||||||
const [listData, setListData] = useState<any | null>(null);
|
const [listData, setListData] = useState<any | null>(null);
|
||||||
const [dataUser, setDataUser] = useState<any | null>(null);
|
const [dataUser, setDataUser] = useState<any | null>(null);
|
||||||
const [loadingGetList, setLoadingGetList] = useState(false);
|
const [loadingGetList, setLoadingGetList] = useState(false);
|
||||||
@@ -38,8 +32,8 @@ export default function Forumku() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
onLoadDataProfile(user?.id as string);
|
onLoadDataProfile(id as string);
|
||||||
}, [user?.id])
|
}, [id])
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadDataProfile = async (id: string) => {
|
const onLoadDataProfile = async (id: string) => {
|
||||||
@@ -71,7 +65,17 @@ export default function Forumku() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper>
|
<ViewWrapper
|
||||||
|
floatingButton={
|
||||||
|
user?.id === id && (
|
||||||
|
<FloatingButton
|
||||||
|
onPress={() =>
|
||||||
|
router.navigate("/(application)/(user)/forum/create")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<CenterCustom>
|
<CenterCustom>
|
||||||
<AvatarComp
|
<AvatarComp
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default function Forum_BoxDetailSection({
|
|||||||
<Grid.Col span={2}>
|
<Grid.Col span={2}>
|
||||||
<AvatarComp
|
<AvatarComp
|
||||||
fileId={data?.Author?.Profile?.imageId}
|
fileId={data?.Author?.Profile?.imageId}
|
||||||
href={`/profile/${data?.Author?.Profile?.id}`}
|
href={`/forum/${data?.Author?.id}/forumku`}
|
||||||
size={"base"}
|
size={"base"}
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|||||||
Reference in New Issue
Block a user