amalia/07-mei-26 #45

Merged
amaliadwiy merged 3 commits from amalia/07-mei-26 into join 2026-05-07 17:38:34 +08:00
16 changed files with 857 additions and 307 deletions
Showing only changes of commit fad89fc910 - Show all commits

View File

@@ -21,6 +21,7 @@ import { router, useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { Pressable, RefreshControl, ScrollView, View, VirtualizedList } from "react-native";
import { useSelector } from "react-redux";
import AsyncStorage from "@react-native-async-storage/async-storage";
type Props = {
id: string;
@@ -36,6 +37,18 @@ export default function ListTask() {
const { id, status, year } = useLocalSearchParams<{ id: string; status: string; year: string }>()
const [isList, setList] = useState(false)
const { token, decryptToken } = useAuthSession()
useEffect(() => {
AsyncStorage.getItem('division_view_mode').then((val) => {
if (val !== null) setList(val === 'list')
})
}, [])
function toggleView() {
const next = !isList
setList(next)
AsyncStorage.setItem('division_view_mode', next ? 'list' : 'grid')
}
const [data, setData] = useState<Props[]>([])
const [search, setSearch] = useState("")
const update = useSelector((state: any) => state.taskUpdate)
@@ -172,13 +185,9 @@ export default function ListTask() {
n={4}
/>
</ScrollView>
<View style={[Styles.rowSpaceBetween]}>
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
<InputSearch width={68} onChange={setSearch} />
<Pressable
onPress={() => {
setList(!isList);
}}
>
<Pressable onPress={toggleView}>
<MaterialCommunityIcons
name={isList ? "format-list-bulleted" : "view-grid"}
color={colors.text}
@@ -219,9 +228,10 @@ export default function ListTask() {
router.push(`./task/${item.id}`);
}}
borderType="bottom"
bgColor="transparent"
icon={
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
<AntDesign name="areachart" size={25} color={"#384288"} />
<View style={[Styles.iconContent]}>
<AntDesign name="areachart" size={25} color={"black"} />
</View>
}
title={item.title}

View File

@@ -17,6 +17,7 @@ import {
Ionicons,
MaterialCommunityIcons
} from "@expo/vector-icons";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
import { router, useLocalSearchParams } from "expo-router";
import { useEffect, useMemo, useState } from "react";
@@ -37,6 +38,18 @@ export default function ListDivision() {
cat?: string;
}>();
const [isList, setList] = useState(false);
useEffect(() => {
AsyncStorage.getItem('division_view_mode').then((val) => {
if (val !== null) setList(val === 'list')
})
}, [])
function toggleView() {
const next = !isList
setList(next)
AsyncStorage.setItem('division_view_mode', next ? 'list' : 'grid')
}
const entityUser = useSelector((state: any) => state.user)
const { token, decryptToken } = useAuthSession()
const { colors } = useTheme();
@@ -184,11 +197,7 @@ export default function ListDivision() {
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
<InputSearch width={68} onChange={setSearch} />
<Pressable
onPress={() => {
setList(!isList);
}}
>
<Pressable onPress={toggleView}>
<MaterialCommunityIcons
name={isList ? "format-list-bulleted" : "view-grid"}
color={colors.text}

View File

@@ -23,6 +23,7 @@ import { router, useLocalSearchParams } from "expo-router";
import { useEffect, useMemo, useState } from "react";
import { Pressable, RefreshControl, ScrollView, View, VirtualizedList } from "react-native";
import { useSelector } from "react-redux";
import AsyncStorage from "@react-native-async-storage/async-storage";
type Props = {
id: string;
@@ -50,6 +51,18 @@ export default function ListProject() {
const [search, setSearch] = useState("")
const [isList, setList] = useState(false)
const update = useSelector((state: any) => state.projectUpdate)
useEffect(() => {
AsyncStorage.getItem('division_view_mode').then((val) => {
if (val !== null) setList(val === 'list')
})
}, [])
function toggleView() {
const next = !isList
setList(next)
AsyncStorage.setItem('division_view_mode', next ? 'list' : 'grid')
}
const queryClient = useQueryClient()
const [refreshing, setRefreshing] = useState(false)
@@ -188,11 +201,7 @@ export default function ListProject() {
<View style={[Styles.rowSpaceBetween, Styles.rowItemsCenter]}>
<InputSearch width={68} onChange={setSearch} />
<Pressable
onPress={() => {
setList(!isList);
}}
>
<Pressable onPress={toggleView}>
<MaterialCommunityIcons
name={isList ? "format-list-bulleted" : "view-grid"}
color={colors.text}