Event
Fix: Intergrasi tampilan ke API Package.json Fix: Pem baharuan SDK53 -> SDK54 ### No Issue
This commit is contained in:
@@ -36,6 +36,7 @@ export default {
|
|||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
'expo-router',
|
'expo-router',
|
||||||
|
'expo-web-browser',
|
||||||
[
|
[
|
||||||
'expo-splash-screen',
|
'expo-splash-screen',
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,17 +1,58 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
AvatarUsernameAndOtherComponent,
|
AvatarUsernameAndOtherComponent,
|
||||||
|
BadgeCustom,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
ViewWrapper,
|
LoaderCustom,
|
||||||
|
TextCustom,
|
||||||
|
ViewWrapper
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
|
import { apiEventListOfParticipants } from "@/service/api-client/api-event";
|
||||||
|
import { useLocalSearchParams } from "expo-router";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function EventListOfParticipants() {
|
export default function EventListOfParticipants() {
|
||||||
|
const { id } = useLocalSearchParams();
|
||||||
|
const [listData, setListData] = useState([]);
|
||||||
|
const [isLoadData, setIsLoadData] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setIsLoadData(true);
|
||||||
|
const response = await apiEventListOfParticipants({ id: id as string });
|
||||||
|
if (response.success) {
|
||||||
|
console.log("Response", JSON.stringify(response.data, null, 2));
|
||||||
|
setListData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoadData(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
{Array.from({ length: 10 }).map((_, index) => (
|
{isLoadData ? (
|
||||||
<BaseBox key={index} paddingBlock={0}>
|
<LoaderCustom />
|
||||||
<AvatarUsernameAndOtherComponent avatarHref={`/profile/${index}`} />
|
) : listData.length === 0 ? (
|
||||||
</BaseBox>
|
<TextCustom align="center">Belum ada peserta</TextCustom>
|
||||||
))}
|
) : (
|
||||||
|
listData.map((item: any, index: number) => (
|
||||||
|
<BaseBox key={index}>
|
||||||
|
<AvatarUsernameAndOtherComponent
|
||||||
|
avatar={item?.User?.Profile?.imageId}
|
||||||
|
name={item?.User?.username}
|
||||||
|
avatarHref={`/profile/${item?.User?.Profile?.id}`}
|
||||||
|
rightComponent={<BadgeCustom color={item?.isPresent ? "green" : "red"}>{item?.isPresent ? "Hadir" : "Tidak Hadir"}</BadgeCustom>}
|
||||||
|
/>
|
||||||
|
</BaseBox>
|
||||||
|
))
|
||||||
|
)}
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,16 +9,19 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
||||||
import LeftButtonCustom from "@/components/Button/BackButton";
|
import LeftButtonCustom from "@/components/Button/BackButton";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import Event_BoxDetailPublishSection from "@/screens/Event/BoxDetailPublishSection";
|
import Event_BoxDetailPublishSection from "@/screens/Event/BoxDetailPublishSection";
|
||||||
import { menuDrawerPublishEvent } from "@/screens/Event/menuDrawerPublish";
|
import { menuDrawerPublishEvent } from "@/screens/Event/menuDrawerPublish";
|
||||||
import { apiEventGetOne } from "@/service/api-client/api-event";
|
import { apiEventGetOne, apiEventJoin } from "@/service/api-client/api-event";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Alert } from "react-native";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function EventDetailPublish() {
|
export default function EventDetailPublish() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
|
const { user } = useAuth();
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
|
const [isLoadingJoin, setIsLoadingJoin] = useState(false);
|
||||||
|
|
||||||
const [data, setData] = useState();
|
const [data, setData] = useState();
|
||||||
|
|
||||||
@@ -43,11 +46,43 @@ export default function EventDetailPublish() {
|
|||||||
setOpenDrawer(false);
|
setOpenDrawer(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handlerJoin = async () => {
|
||||||
|
const userId = user?.id;
|
||||||
|
if (!userId) {
|
||||||
|
return Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text2: "Anda belum login",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setIsLoadingJoin(true);
|
||||||
|
const response = await apiEventJoin({
|
||||||
|
id: id as string,
|
||||||
|
userId: userId as string,
|
||||||
|
});
|
||||||
|
if (response.success) {
|
||||||
|
router.navigate(
|
||||||
|
`/(application)/(user)/event/${id}/list-of-participants`
|
||||||
|
);
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Anda berhasil join",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoadingJoin(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const footerButton = (
|
const footerButton = (
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
|
isLoading={isLoadingJoin}
|
||||||
backgroundColor="green"
|
backgroundColor="green"
|
||||||
textColor="white"
|
textColor="white"
|
||||||
onPress={() => Alert.alert("Anda berhasil join event ini")}
|
onPress={() => handlerJoin()}
|
||||||
>
|
>
|
||||||
Join
|
Join
|
||||||
</ButtonCustom>
|
</ButtonCustom>
|
||||||
@@ -63,7 +98,10 @@ export default function EventDetailPublish() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
<Event_BoxDetailPublishSection data={data} footerButton={footerButton} />
|
<Event_BoxDetailPublishSection
|
||||||
|
data={data}
|
||||||
|
footerButton={footerButton}
|
||||||
|
/>
|
||||||
<Spacing />
|
<Spacing />
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
@@ -75,7 +113,7 @@ export default function EventDetailPublish() {
|
|||||||
<MenuDrawerDynamicGrid
|
<MenuDrawerDynamicGrid
|
||||||
data={menuDrawerPublishEvent({ id: id as string })}
|
data={menuDrawerPublishEvent({ id: id as string })}
|
||||||
columns={4}
|
columns={4}
|
||||||
// onPressItem={handlePress}
|
onPressItem={handlePress as any}
|
||||||
/>
|
/>
|
||||||
</DrawerCustom>
|
</DrawerCustom>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import { AccentColor, MainColor } from "@/constants/color-palet";
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
import { TEXT_SIZE_SMALL } from "@/constants/constans-value";
|
import { TEXT_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
||||||
@@ -5,19 +6,23 @@ import { IMenuDrawerItem } from "../_Interface/types";
|
|||||||
import { Href } from "expo-router";
|
import { Href } from "expo-router";
|
||||||
|
|
||||||
type IMenuDrawerItemProps = {
|
type IMenuDrawerItemProps = {
|
||||||
icon: React.ReactNode;
|
icon: React.ReactNode;
|
||||||
label: string;
|
label: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
path?: Href | string;
|
path?: Href | string;
|
||||||
color?: string;
|
color?: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface MenuDrawerDynamicGridProps {
|
interface MenuDrawerDynamicGridProps {
|
||||||
data: IMenuDrawerItemProps[];
|
data: IMenuDrawerItemProps[];
|
||||||
columns?: number;
|
columns?: number;
|
||||||
onPressItem?: (item: IMenuDrawerItemProps) => void;
|
onPressItem?: (item: IMenuDrawerItemProps) => void;
|
||||||
}
|
}
|
||||||
const MenuDrawerDynamicGrid = ({ data, columns = 4, onPressItem }: MenuDrawerDynamicGridProps) => {
|
const MenuDrawerDynamicGrid = ({
|
||||||
|
data,
|
||||||
|
columns = 4,
|
||||||
|
onPressItem,
|
||||||
|
}: MenuDrawerDynamicGridProps) => {
|
||||||
const numColumns = columns;
|
const numColumns = columns;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
18107
package-lock.json
generated
18107
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
84
package.json
84
package.json
@@ -11,65 +11,69 @@
|
|||||||
"lint": "expo lint"
|
"lint": "expo lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^14.1.0",
|
"@expo/vector-icons": "^15.0.2",
|
||||||
"@react-native-async-storage/async-storage": "2.1.2",
|
"@react-native-async-storage/async-storage": "2.2.0",
|
||||||
"@react-native-community/datetimepicker": "8.4.1",
|
"@react-native-community/datetimepicker": "8.4.4",
|
||||||
"@react-navigation/bottom-tabs": "^7.4.2",
|
"@react-navigation/bottom-tabs": "^7.3.10",
|
||||||
"@react-navigation/drawer": "^7.5.2",
|
"@react-navigation/drawer": "^7.3.9",
|
||||||
"@react-navigation/elements": "^2.3.8",
|
"@react-navigation/elements": "^2.3.8",
|
||||||
"@react-navigation/native": "^7.1.6",
|
"@react-navigation/native": "^7.1.6",
|
||||||
"@react-navigation/native-stack": "^7.3.21",
|
"@react-navigation/native-stack": "^7.3.10",
|
||||||
"@types/lodash": "^4.17.20",
|
"@types/lodash": "^4.17.20",
|
||||||
"@types/react-native-vector-icons": "^6.4.18",
|
"@types/react-native-vector-icons": "^6.4.18",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"expo": "53.0.17",
|
"expo": "^54.0.0",
|
||||||
"expo-blur": "~14.1.5",
|
"expo-blur": "~15.0.7",
|
||||||
"expo-camera": "~16.1.10",
|
"expo-camera": "~17.0.7",
|
||||||
"expo-clipboard": "~7.1.5",
|
"expo-clipboard": "~8.0.7",
|
||||||
"expo-constants": "~17.1.7",
|
"expo-constants": "~18.0.8",
|
||||||
"expo-dev-client": "~5.2.4",
|
"expo-dev-client": "~6.0.12",
|
||||||
"expo-document-picker": "~13.1.6",
|
"expo-document-picker": "~14.0.7",
|
||||||
"expo-file-system": "~18.1.11",
|
"expo-file-system": "~19.0.12",
|
||||||
"expo-font": "~13.3.2",
|
"expo-font": "~14.0.8",
|
||||||
"expo-haptics": "~14.1.4",
|
"expo-haptics": "~15.0.7",
|
||||||
"expo-image": "~2.3.2",
|
"expo-image": "~3.0.8",
|
||||||
"expo-image-picker": "~16.1.4",
|
"expo-image-picker": "~17.0.8",
|
||||||
"expo-linking": "~7.1.7",
|
"expo-linking": "~8.0.8",
|
||||||
"expo-router": "~5.1.3",
|
"expo-router": "~6.0.1",
|
||||||
"expo-splash-screen": "~0.30.10",
|
"expo-splash-screen": "~31.0.9",
|
||||||
"expo-status-bar": "~2.2.3",
|
"expo-status-bar": "~3.0.8",
|
||||||
"expo-symbols": "~0.4.5",
|
"expo-symbols": "~1.0.7",
|
||||||
"expo-system-ui": "~5.0.10",
|
"expo-system-ui": "~6.0.7",
|
||||||
"expo-web-browser": "~14.2.0",
|
"expo-web-browser": "~15.0.7",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"react": "19.0.0",
|
"react": "19.1.0",
|
||||||
"react-dom": "19.0.0",
|
"react-dom": "19.1.0",
|
||||||
"react-native": "0.79.5",
|
"react-native": "0.81.4",
|
||||||
"react-native-dotenv": "^3.4.11",
|
"react-native-dotenv": "^3.4.11",
|
||||||
"react-native-gesture-handler": "~2.24.0",
|
"react-native-gesture-handler": "~2.28.0",
|
||||||
"react-native-international-phone-number": "^0.9.3",
|
"react-native-international-phone-number": "^0.9.3",
|
||||||
"react-native-maps": "1.20.1",
|
"react-native-maps": "1.20.1",
|
||||||
"react-native-otp-entry": "^1.8.5",
|
"react-native-otp-entry": "^1.8.5",
|
||||||
"react-native-pager-view": "6.7.1",
|
"react-native-pager-view": "6.9.1",
|
||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-qrcode-svg": "^6.3.15",
|
"react-native-qrcode-svg": "^6.3.15",
|
||||||
"react-native-reanimated": "~3.17.4",
|
"react-native-reanimated": "~4.1.0",
|
||||||
"react-native-safe-area-context": "5.4.0",
|
"react-native-safe-area-context": "~5.6.0",
|
||||||
"react-native-screens": "~4.11.1",
|
"react-native-screens": "~4.16.0",
|
||||||
"react-native-svg": "15.11.2",
|
"react-native-svg": "15.12.1",
|
||||||
"react-native-toast-message": "^2.3.3",
|
"react-native-toast-message": "^2.3.3",
|
||||||
"react-native-vector-icons": "^10.2.0",
|
"react-native-vector-icons": "^10.2.0",
|
||||||
"react-native-web": "~0.20.0",
|
"react-native-web": "^0.21.0",
|
||||||
"react-native-webview": "13.13.5"
|
"react-native-webview": "13.15.0",
|
||||||
|
"react-native-worklets": "^0.5.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.25.2",
|
||||||
"@types/react": "~19.0.10",
|
"@types/react": "~19.1.10",
|
||||||
"eslint": "^9.25.0",
|
"eslint": "^9.25.0",
|
||||||
"eslint-config-expo": "~9.2.0",
|
"eslint-config-expo": "~10.0.0",
|
||||||
"expo-module-scripts": "^4.1.10",
|
"expo-module-scripts": "^4.1.10",
|
||||||
"typescript": "~5.8.3"
|
"typescript": "~5.9.2"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"bun": ">=1.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AvatarUsernameAndOtherComponent, BaseBox, BoxWithHeaderSection, Grid, StackCustom, TextCustom } from "@/components";
|
import { AvatarUsernameAndOtherComponent, BoxWithHeaderSection, Grid, StackCustom, TextCustom } from "@/components";
|
||||||
import { dateTimeView } from "@/utils/dateTimeView";
|
import { dateTimeView } from "@/utils/dateTimeView";
|
||||||
|
|
||||||
export default function Event_BoxDetailPublishSection({
|
export default function Event_BoxDetailPublishSection({
|
||||||
@@ -31,7 +31,6 @@ export default function Event_BoxDetailPublishSection({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log("DATA >> ", JSON.stringify(data, null, 2));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -52,7 +52,13 @@ export async function apiEventUpdateStatus({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function apiEventUpdateData({ id, data }: { id: string; data: any }) {
|
export async function apiEventUpdateData({
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
data: any;
|
||||||
|
}) {
|
||||||
try {
|
try {
|
||||||
const response = await apiConfig.put(`/mobile/event/${id}`, {
|
const response = await apiConfig.put(`/mobile/event/${id}`, {
|
||||||
data: data,
|
data: data,
|
||||||
@@ -71,7 +77,6 @@ export async function apiEventDelete({ id }: { id: string }) {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function apiEventGetAll() {
|
export async function apiEventGetAll() {
|
||||||
try {
|
try {
|
||||||
@@ -81,4 +86,30 @@ export async function apiEventGetAll() {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function apiEventJoin({
|
||||||
|
id,
|
||||||
|
userId,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
userId?: string;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.post(`/mobile/event/${id}/participants`, {
|
||||||
|
userId: userId,
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiEventListOfParticipants({id}: {id: string}){
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/mobile/event/${id}/participants`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user