API Profile:
Fix: - api create, get , edit Types Add: - Type-Profile ### No Issue
This commit is contained in:
@@ -12,6 +12,8 @@ const AvatarAndBackground = ({
|
||||
imageId: string;
|
||||
}) => {
|
||||
return (
|
||||
// console.log("backgroundId", backgroundId),
|
||||
// console.log("imageId", imageId),
|
||||
<View style={styles.container}>
|
||||
{/* Background Image */}
|
||||
<ClickableCustom
|
||||
|
||||
@@ -5,85 +5,139 @@ import { Ionicons } from "@expo/vector-icons";
|
||||
|
||||
export const drawerItemsProfile = ({
|
||||
id,
|
||||
isAdmin,
|
||||
}: {
|
||||
id: string;
|
||||
}): IMenuDrawerItem[] => [
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="create"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Edit profile",
|
||||
path: `/(application)/profile/${id}/edit`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="camera"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Ubah foto profile",
|
||||
path: `/(application)/profile/${id}/update-photo`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="image"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Ubah latar belakang",
|
||||
path: `/(application)/profile/${id}/update-background`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="add-circle"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Tambah portofolio",
|
||||
path: `/(application)/portofolio/${id}/create`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="settings"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Dashboard Admin",
|
||||
path: `/(application)/admin/dashboard`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="log-out"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Keluar",
|
||||
color: MainColor.red,
|
||||
path: "",
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="create-outline"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Create profile",
|
||||
path: `/(application)/profile/${id}/create`,
|
||||
},
|
||||
];
|
||||
isAdmin: boolean;
|
||||
}) => {
|
||||
const adminItems: IMenuDrawerItem[] = [
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="create"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Edit profile",
|
||||
path: `/(application)/profile/${id}/edit`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="camera"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Ubah foto profile",
|
||||
path: `/(application)/profile/${id}/update-photo`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="image"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Ubah latar belakang",
|
||||
path: `/(application)/profile/${id}/update-background`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="add-circle"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Tambah portofolio",
|
||||
path: `/(application)/portofolio/${id}/create`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="settings"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Dashboard Admin",
|
||||
path: `/(application)/admin/dashboard`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="log-out"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Keluar",
|
||||
color: MainColor.red,
|
||||
path: "",
|
||||
},
|
||||
];
|
||||
|
||||
const userItems: IMenuDrawerItem[] = [
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="create"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Edit profile",
|
||||
path: `/(application)/profile/${id}/edit`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="camera"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Ubah foto profile",
|
||||
path: `/(application)/profile/${id}/update-photo`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="image"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Ubah latar belakang",
|
||||
path: `/(application)/profile/${id}/update-background`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="add-circle"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Tambah portofolio",
|
||||
path: `/(application)/portofolio/${id}/create`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons
|
||||
name="log-out"
|
||||
size={ICON_SIZE_MEDIUM}
|
||||
color={AccentColor.white}
|
||||
/>
|
||||
),
|
||||
label: "Keluar",
|
||||
color: MainColor.red,
|
||||
path: "",
|
||||
},
|
||||
];
|
||||
|
||||
return isAdmin ? adminItems : userItems;
|
||||
};
|
||||
|
||||
@@ -5,8 +5,10 @@ import { FontAwesome5, Ionicons } from "@expo/vector-icons";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { View } from "react-native";
|
||||
import AvatarAndBackground from "./AvatarAndBackground";
|
||||
import { IProfile } from "@/types/Type-Profile";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function ProfileSection() {
|
||||
export default function ProfileSection({ data }: { data: IProfile }) {
|
||||
const { id } = useLocalSearchParams();
|
||||
|
||||
const listData = [
|
||||
@@ -14,13 +16,13 @@ export default function ProfileSection() {
|
||||
icon: (
|
||||
<Ionicons name="call-outline" size={ICON_SIZE_SMALL} color="white" />
|
||||
),
|
||||
label: "+6282340374412",
|
||||
label: `+${data && data.User.nomor ? data.User.nomor : "-"}`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<Ionicons name="mail-outline" size={ICON_SIZE_SMALL} color="white" />
|
||||
),
|
||||
label: "bagasbanuna@gmail.com",
|
||||
label: `${data && data.email ? data.email : "-"}`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
@@ -30,28 +32,38 @@ export default function ProfileSection() {
|
||||
color="white"
|
||||
/>
|
||||
),
|
||||
label: "Jalan Raya Sesetan No. 123, Bandung, Indonesia",
|
||||
label: `${data && data.alamat ? data.alamat : "-"}`,
|
||||
},
|
||||
{
|
||||
icon: (
|
||||
<FontAwesome5 name="transgender" size={ICON_SIZE_SMALL} color="white" />
|
||||
),
|
||||
label: "Laki-laki",
|
||||
label: `${
|
||||
data && data.jenisKelamin ? _.startCase(data.jenisKelamin) : "-"
|
||||
}`,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<BaseBox>
|
||||
<AvatarAndBackground backgroundId="test-background-id" imageId="test-image-id" />
|
||||
{/* <TextCustom>
|
||||
{JSON.stringify(data.imageBackgroundId, null, 2)}
|
||||
</TextCustom> */}
|
||||
<AvatarAndBackground
|
||||
backgroundId={data?.imageBackgroundId as any}
|
||||
imageId={data?.imageId as any}
|
||||
/>
|
||||
<Spacing height={50} />
|
||||
|
||||
<View style={{ alignItems: "center" }}>
|
||||
<TextCustom bold size="large" align="center">
|
||||
Nama User
|
||||
{data && data.name ? data.name : "-"}
|
||||
</TextCustom>
|
||||
<Spacing height={5} />
|
||||
<TextCustom size="small">@Username</TextCustom>
|
||||
<TextCustom size="small">
|
||||
@{data && data.User.username ? data.User.username : "-"}
|
||||
</TextCustom>
|
||||
</View>
|
||||
<Spacing height={30} />
|
||||
|
||||
|
||||
@@ -5,12 +5,10 @@ import { router } from "expo-router";
|
||||
|
||||
export default function Profile_MenuDrawerSection({
|
||||
drawerItems,
|
||||
setShowLogoutAlert,
|
||||
setIsDrawerOpen,
|
||||
logout,
|
||||
}: {
|
||||
drawerItems: IMenuDrawerItem[];
|
||||
setShowLogoutAlert: (value: boolean) => void;
|
||||
setIsDrawerOpen: (value: boolean) => void;
|
||||
logout: () => Promise<void>;
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user