Deskripsi:

Event:
Add history detail
Fix : - nama variabel pada [id]/

Component
Fix:
- Spacing : tipe data num | str
- ScrollView : tambah background

# No Issue "
This commit is contained in:
2025-07-22 14:56:29 +08:00
parent 7889d25a44
commit 814f261881
14 changed files with 293 additions and 74 deletions

View File

@@ -4,7 +4,7 @@ import { FontAwesome5, Ionicons } from "@expo/vector-icons";
import { Tabs } from "expo-router"; import { Tabs } from "expo-router";
import { Platform, View } from "react-native"; import { Platform, View } from "react-native";
export default function EventLayout() { export default function EventTabsLayout() {
return ( return (
<Tabs <Tabs
screenOptions={{ screenOptions={{

View File

@@ -8,7 +8,7 @@ import {
ViewWrapper, ViewWrapper,
} from "@/components"; } from "@/components";
export default function Kontribusi() { export default function EventContribution() {
return ( return (
<ViewWrapper hideFooter> <ViewWrapper hideFooter>
{Array.from({ length: 10 }).map((_, index) => ( {Array.from({ length: 10 }).map((_, index) => (

View File

@@ -1,11 +1,67 @@
import { ButtonCustom, Spacing, TextCustom } from "@/components";
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper"; import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
import { GStyles } from "@/styles/global-styles"; import { AccentColor, MainColor } from "@/constants/color-palet";
import { Text } from "react-native"; import Event_BoxPublishSection from "@/screens/Event/BoxPublishSection";
import { useState } from "react";
import { View } from "react-native";
export default function EventHistory() {
const [activeCategory, setActiveCategory] = useState<string | null>("all");
const handlePress = (item: any) => {
setActiveCategory(item);
// tambahkan logika lain seperti filter dsb.
};
const headerComponent = (
<View
style={{
flexDirection: "row",
alignItems: "center",
padding: 5,
backgroundColor: MainColor.soft_darkblue,
borderRadius: 50,
width: "100%",
}}
>
<ButtonCustom
backgroundColor={
activeCategory === "all" ? MainColor.yellow : AccentColor.blue
}
textColor={activeCategory === "all" ? MainColor.black : MainColor.white}
style={{ width: "49%" }}
onPress={() => handlePress("all")}
>
Semua Riwayat
</ButtonCustom>
<Spacing width={"2%"} />
<ButtonCustom
backgroundColor={
activeCategory === "main" ? MainColor.yellow : AccentColor.blue
}
textColor={
activeCategory === "main" ? MainColor.black : MainColor.white
}
style={{ width: "49%" }}
onPress={() => handlePress("main")}
>
Riwayat Saya
</ButtonCustom>
</View>
);
export default function Riwayat() {
return ( return (
<ViewWrapper> <ViewWrapper headerComponent={headerComponent} hideFooter>
<Text style={GStyles.textLabel}>Riwayat</Text> {Array.from({ length: 10 }).map((_, index) => (
<Event_BoxPublishSection
key={index.toString()}
id={index.toString()}
username={`Hisrory ${activeCategory === "main" ? "Saya" : "Semua"}`}
rightComponentAvatar={
<TextCustom>{new Date().toLocaleDateString()}</TextCustom>
}
/>
))}
</ViewWrapper> </ViewWrapper>
); );
} }

View File

@@ -3,7 +3,7 @@ import FloatingButton from "@/components/Button/FloatingButton";
import Event_BoxPublishSection from "@/screens/Event/BoxPublishSection"; import Event_BoxPublishSection from "@/screens/Event/BoxPublishSection";
import { router } from "expo-router"; import { router } from "expo-router";
export default function Event() { export default function EventBeranda() {
return ( return (
<ViewWrapper <ViewWrapper
hideFooter hideFooter

View File

@@ -9,7 +9,7 @@ import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
import { masterStatus } from "@/lib/dummy-data/_master/status"; import { masterStatus } from "@/lib/dummy-data/_master/status";
import { useState } from "react"; import { useState } from "react";
export default function Status() { export default function EventStatus() {
const id = "test-id-event"; const id = "test-id-event";
const [activeCategory, setActiveCategory] = useState<string | null>( const [activeCategory, setActiveCategory] = useState<string | null>(

View File

@@ -17,7 +17,7 @@ import { menuDrawerDraftEvent } from "@/screens/Event/menuDrawerDraft";
import { router, Stack, useLocalSearchParams } from "expo-router"; import { router, Stack, useLocalSearchParams } from "expo-router";
import { useState } from "react"; import { useState } from "react";
export default function EventDetail() { export default function EventDetailStatus() {
const { id, status } = useLocalSearchParams(); const { id, status } = useLocalSearchParams();
const [openDrawer, setOpenDrawer] = useState(false); const [openDrawer, setOpenDrawer] = useState(false);
const [openAlert, setOpenAlert] = useState(false); const [openAlert, setOpenAlert] = useState(false);

View File

@@ -12,7 +12,7 @@ import { menuDrawerPublishEvent } from "@/screens/Event/menuDrawerPublish";
import { router, Stack, useLocalSearchParams } from "expo-router"; import { router, Stack, useLocalSearchParams } from "expo-router";
import { useState } from "react"; import { useState } from "react";
export default function EventContribution() { export default function EventDetailContribution() {
const { id } = useLocalSearchParams(); const { id } = useLocalSearchParams();
const [openDrawer, setOpenDrawer] = useState(false); const [openDrawer, setOpenDrawer] = useState(false);

View File

@@ -1,11 +1,105 @@
import { StackCustom, TextCustom, ViewWrapper } from "@/components"; import {
ButtonCustom,
SelectCustom,
StackCustom,
TextAreaCustom,
TextInputCustom,
ViewWrapper,
} from "@/components";
import DateTimePickerCustom from "@/components/DateInput/DateTimePickerCustom";
import { masterTypeEvent } from "@/lib/dummy-data/event/master-type-event";
import { DateTimePickerEvent } from "@react-native-community/datetimepicker";
import { router } from "expo-router";
import React, { useState } from "react";
import { Platform } from "react-native";
export default function EventEdit() { export default function EventEdit() {
const [selectedDate, setSelectedDate] = useState<
Date | DateTimePickerEvent | null
>(null);
const [selectedEndDate, setSelectedEndDate] = useState<
Date | DateTimePickerEvent | null
>(null);
const handlerSubmit = () => {
try {
if (selectedDate) {
console.log("Tanggal yang dipilih:", selectedDate);
console.log(`ISO Format ${Platform.OS}:`, selectedDate.toString());
// Kirim ke API atau proses lanjutan
} else {
console.log("Tanggal belum dipilih");
}
if (selectedEndDate) {
console.log("Tanggal yang dipilih:", selectedEndDate);
console.log(`ISO Format ${Platform.OS}:`, selectedEndDate.toString());
// Kirim ke API atau proses lanjutan
} else {
console.log("Tanggal berakhir belum dipilih");
}
console.log("Data berhasil terupdate");
router.back()
} catch (error) {
console.log(error);
}
};
const buttonSubmit = (
<ButtonCustom title="Update" onPress={handlerSubmit} />
);
return ( return (
<> <>
<ViewWrapper> <ViewWrapper>
<StackCustom> <StackCustom gap={"xs"}>
<TextCustom>Edit Event</TextCustom> <TextInputCustom
placeholder="Masukkan nama event"
label="Nama Event"
required
/>
<SelectCustom
label="Tipe Event"
placeholder="Pilih tipe event"
data={masterTypeEvent}
onChange={(value) => console.log(value)}
/>
<TextInputCustom
label="Lokasi"
placeholder="Masukkan lokasi event"
required
/>
<DateTimePickerCustom
label="Tanggal & Waktu Mulai"
required
onChange={(date: Date) => {
setSelectedDate(date as any);
}}
value={selectedDate as any}
minimumDate={new Date(Date.now())}
/>
<DateTimePickerCustom
label="Tanggal & Waktu Berakhir"
required
onChange={(date: Date) => {
setSelectedEndDate(date as any);
}}
value={selectedEndDate as any}
/>
<TextAreaCustom
label="Deskripsi"
placeholder="Masukkan deskripsi event"
required
showCount
maxLength={100}
/>
{buttonSubmit}
</StackCustom> </StackCustom>
</ViewWrapper> </ViewWrapper>
</> </>

View File

@@ -0,0 +1,51 @@
import {
DotButton,
DrawerCustom,
MenuDrawerDynamicGrid,
ViewWrapper,
Spacing,
} from "@/components";
import { IMenuDrawerItem } from "@/components/_Interface/types";
import LeftButtonCustom from "@/components/Button/BackButton";
import Event_BoxDetailPublishSection from "@/screens/Event/BoxDetailPublishSection";
import { menuDrawerPublishEvent } from "@/screens/Event/menuDrawerPublish";
import { router, Stack, useLocalSearchParams } from "expo-router";
import { useState } from "react";
export default function EventDetailHistory() {
const { id } = useLocalSearchParams();
const [openDrawer, setOpenDrawer] = useState(false);
const handlePress = (item: IMenuDrawerItem) => {
console.log("PATH ", item.path);
router.navigate(item.path as any);
setOpenDrawer(false);
};
return (
<>
<Stack.Screen
options={{
title: `Detail riwayat`,
headerLeft: () => <LeftButtonCustom />,
headerRight: () => <DotButton onPress={() => setOpenDrawer(true)} />,
}}
/>
<ViewWrapper>
<Event_BoxDetailPublishSection />
<Spacing />
</ViewWrapper>
<DrawerCustom
isVisible={openDrawer}
closeDrawer={() => setOpenDrawer(false)}
height={250}
>
<MenuDrawerDynamicGrid
data={menuDrawerPublishEvent({ id: id as string })}
columns={4}
onPressItem={handlePress}
/>
</DrawerCustom>
</>
);
}

View File

@@ -14,7 +14,7 @@ import { router, Stack, useLocalSearchParams } from "expo-router";
import { useState } from "react"; import { useState } from "react";
import { Alert } from "react-native"; import { Alert } from "react-native";
export default function EventPublish() { export default function EventDetailPublish() {
const { id } = useLocalSearchParams(); const { id } = useLocalSearchParams();
const [openDrawer, setOpenDrawer] = useState(false); const [openDrawer, setOpenDrawer] = useState(false);

View File

@@ -1,15 +1,15 @@
import { import {
BoxButtonOnFooter, ButtonCustom,
ButtonCustom, SelectCustom,
SelectCustom, StackCustom,
StackCustom, TextAreaCustom,
TextAreaCustom, TextInputCustom,
TextInputCustom, ViewWrapper,
ViewWrapper,
} from "@/components"; } from "@/components";
import DateTimePickerCustom from "@/components/DateInput/DateTimePickerCustom"; import DateTimePickerCustom from "@/components/DateInput/DateTimePickerCustom";
import { masterTypeEvent } from "@/lib/dummy-data/event/master-type-event"; import { masterTypeEvent } from "@/lib/dummy-data/event/master-type-event";
import { DateTimePickerEvent } from "@react-native-community/datetimepicker"; import { DateTimePickerEvent } from "@react-native-community/datetimepicker";
import { router } from "expo-router";
import React, { useState } from "react"; import React, { useState } from "react";
import { Platform } from "react-native"; import { Platform } from "react-native";
@@ -23,25 +23,32 @@ export default function EventCreate() {
>(null); >(null);
const handlerSubmit = () => { const handlerSubmit = () => {
if (selectedDate) { try {
console.log("Tanggal yang dipilih:", selectedDate); if (selectedDate) {
console.log(`ISO Format ${Platform.OS}:`, selectedDate.toString()); console.log("Tanggal yang dipilih:", selectedDate);
// Kirim ke API atau proses lanjutan console.log(`ISO Format ${Platform.OS}:`, selectedDate.toString());
} else { // Kirim ke API atau proses lanjutan
console.warn("Tanggal belum dipilih"); } else {
} console.log("Tanggal belum dipilih");
}
if (selectedEndDate) { if (selectedEndDate) {
console.log("Tanggal yang dipilih:", selectedEndDate); console.log("Tanggal yang dipilih:", selectedEndDate);
console.log(`ISO Format ${Platform.OS}:`, selectedEndDate.toString()); console.log(`ISO Format ${Platform.OS}:`, selectedEndDate.toString());
// Kirim ke API atau proses lanjutan // Kirim ke API atau proses lanjutan
} else { } else {
console.warn("Tanggal belum dipilih"); console.log("Tanggal berakhir belum dipilih");
}
console.log("Data berhasil disimpan");
router.navigate("/event/status");
} catch (error) {
console.log(error);
} }
}; };
const buttonSubmit = ( const buttonSubmit = (
<ButtonCustom title="Simpan" onPress={handlerSubmit} /> <ButtonCustom title="Simpan" onPress={handlerSubmit} />
// <BoxButtonOnFooter> // <BoxButtonOnFooter>
// </BoxButtonOnFooter> // </BoxButtonOnFooter>
); );
@@ -96,7 +103,6 @@ export default function EventCreate() {
{buttonSubmit} {buttonSubmit}
</StackCustom> </StackCustom>
</ViewWrapper> </ViewWrapper>
</> </>
); );

View File

@@ -49,6 +49,9 @@ export default ScrollableCustom;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
scrollView: { scrollView: {
backgroundColor: MainColor.soft_darkblue,
borderRadius: 50,
padding: 5,
// maxHeight: 50, // maxHeight: 50,
}, },
buttonContainer: { buttonContainer: {

View File

@@ -3,12 +3,12 @@ import React from "react";
import { View } from "react-native"; import { View } from "react-native";
interface SpacingProps { interface SpacingProps {
width?: number; width?: number | string;
height?: number; height?: number | string;
} }
const Spacing: React.FC<SpacingProps> = ({ width = 20, height = 20 }) => { const Spacing: React.FC<SpacingProps> = ({ width = 20, height = 20 }) => {
return <View style={{ height, width }} />; return <View style={{ height: height as any, width: width as any }} />;
}; };
export default Spacing; export default Spacing;

View File

@@ -1,39 +1,48 @@
import { BaseBox, StackCustom, AvatarUsernameAndOtherComponent, TextCustom } from "@/components"; import {
AvatarUsernameAndOtherComponent,
BaseBox,
StackCustom,
TextCustom,
} from "@/components";
export default function Event_BoxPublishSection({ export default function Event_BoxPublishSection({
id, id,
name, title,
avatarHref, username,
description, description,
footerButton
}: {
id: string;
name?: string;
avatarHref?: string;
description?: string;
footerButton?: React.ReactNode;
}) {
return (
<>
<BaseBox href={`/event/${id}/publish`}>
<StackCustom gap={"xs"}>
<AvatarUsernameAndOtherComponent
avatarHref={`/profile/${id}`}
name="Lorem ipsum dolor sit"
/>
<TextCustom truncate bold>
Lorem ipsum dolor sit
</TextCustom>
<TextCustom truncate={2}>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro sed
doloremque tempora soluta. Dolorem ex quidem ipsum tempora, ipsa,
obcaecati quia suscipit numquam, voluptates commodi porro impedit
natus quos doloremque!
</TextCustom>
</StackCustom>
</BaseBox>
{footerButton}
</>
);
}
// Avatar
sourceAvatar,
rightComponentAvatar,
}: {
id: string;
title?: string;
username?: string;
description?: string;
// Avatar
sourceAvatar?: string;
rightComponentAvatar?: React.ReactNode;
}) {
return (
<>
<BaseBox href={`/event/${id}/history`}>
<StackCustom gap={"xs"}>
<AvatarUsernameAndOtherComponent
avatarHref={`/profile/${id}`}
name={username || "Lorem ipsum dolor sit"}
rightComponent={rightComponentAvatar}
avatar={sourceAvatar as any}
/>
<TextCustom truncate bold>
{title || "Lorem ipsum dolor sit"}
</TextCustom>
<TextCustom truncate={2}>
{description ||
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro sed doloremque tempora soluta. Dolorem ex quidem ipsum tempora, ipsa, obcaecati quia suscipit numquam, voluptates commodi porro impedit natus quos doloremque!"}
</TextCustom>
</StackCustom>
</BaseBox>
</>
);
}