upd: skeleton dokumen
Deskripsi: - dokumen divisi NO Issues
This commit is contained in:
@@ -9,6 +9,7 @@ import { InputForm } from "@/components/inputForm";
|
|||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalFloat from "@/components/modalFloat";
|
import ModalFloat from "@/components/modalFloat";
|
||||||
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
||||||
|
import Skeleton from "@/components/skeleton";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import {
|
import {
|
||||||
@@ -69,6 +70,8 @@ export default function DocumentDivision() {
|
|||||||
const [modalMore, setModalMore] = useState(false);
|
const [modalMore, setModalMore] = useState(false);
|
||||||
const [isRename, setRename] = useState(false);
|
const [isRename, setRename] = useState(false);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
const arrSkeleton = Array.from({ length: 3 })
|
||||||
const update = useSelector((state: any) => state.dokumenUpdate);
|
const update = useSelector((state: any) => state.dokumenUpdate);
|
||||||
const [bodyRename, setBodyRename] = useState({
|
const [bodyRename, setBodyRename] = useState({
|
||||||
id: "",
|
id: "",
|
||||||
@@ -80,6 +83,7 @@ export default function DocumentDivision() {
|
|||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiGetDocument({
|
const response = await apiGetDocument({
|
||||||
user: hasil,
|
user: hasil,
|
||||||
@@ -91,6 +95,8 @@ export default function DocumentDivision() {
|
|||||||
setDataJalur(response.jalur);
|
setDataJalur(response.jalur);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +300,13 @@ export default function DocumentDivision() {
|
|||||||
<ScrollView style={{ height: "100%" }}>
|
<ScrollView style={{ height: "100%" }}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
{dataJalur.map((item, index) => (
|
{
|
||||||
|
loading ?
|
||||||
|
arrSkeleton.map((item, index) => (
|
||||||
|
<Skeleton key={index} width={60} height={10} borderRadius={10} style={[Styles.mr05]} />
|
||||||
|
))
|
||||||
|
:
|
||||||
|
dataJalur.map((item, index) => (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.rowItemsCenter]}
|
style={[Styles.rowItemsCenter]}
|
||||||
@@ -307,10 +319,17 @@ export default function DocumentDivision() {
|
|||||||
)}
|
)}
|
||||||
<Text> {item.name} </Text>
|
<Text> {item.name} </Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
))}
|
))
|
||||||
|
}
|
||||||
</View>
|
</View>
|
||||||
<View>
|
<View>
|
||||||
{data.length > 0 ? (
|
{
|
||||||
|
loading ?
|
||||||
|
arrSkeleton.map((item, index) => (
|
||||||
|
<Skeleton key={index} width={100} widthType="percent" height={50} borderRadius={10} />
|
||||||
|
))
|
||||||
|
:
|
||||||
|
data.length > 0 ? (
|
||||||
data.map((item, index) => {
|
data.map((item, index) => {
|
||||||
const isSelected = selectedFiles.some(
|
const isSelected = selectedFiles.some(
|
||||||
(i: any) => i?.id == item.id
|
(i: any) => i?.id == item.id
|
||||||
|
|||||||
Reference in New Issue
Block a user