-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from nikgraf/ui-styling
UI styling
- Loading branch information
Showing
57 changed files
with
2,463 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { DrawerActions } from "@react-navigation/native"; | ||
import { Redirect, useNavigation, usePathname } from "expo-router"; | ||
import { Drawer } from "expo-router/drawer"; | ||
import { Pressable, useWindowDimensions } from "react-native"; | ||
import { GestureHandlerRootView } from "react-native-gesture-handler"; | ||
import { PanelLeft } from "~/lib/icons/PanelLeft"; | ||
import { DrawerContent } from "../../components/drawerContent"; | ||
import { useIsPermanentLeftDrawer } from "../../hooks/useIsPermanentDrawer"; | ||
import { getSessionKey } from "../../utils/sessionKeyStorage"; | ||
|
||
export default function Layout() { | ||
const isPermanentLeftDrawer = useIsPermanentLeftDrawer(); | ||
const { width: fullWidth } = useWindowDimensions(); | ||
const pathname = usePathname(); | ||
|
||
const sessionKey = getSessionKey(); | ||
if (!sessionKey) { | ||
const redirect = pathname !== "/" ? "?redirect=" + pathname : ""; | ||
return <Redirect href={`/login${redirect}`} />; | ||
} | ||
|
||
return ( | ||
<GestureHandlerRootView style={{ flex: 1 }}> | ||
<Drawer | ||
drawerContent={DrawerContent} | ||
screenOptions={{ | ||
drawerType: isPermanentLeftDrawer ? "permanent" : "front", | ||
drawerStyle: { | ||
width: isPermanentLeftDrawer ? 240 : fullWidth, | ||
}, | ||
overlayColor: "transparent", | ||
drawerPosition: "left", | ||
headerShown: isPermanentLeftDrawer ? false : true, | ||
headerLeft: () => { | ||
const navigation = useNavigation(); | ||
|
||
return ( | ||
<Pressable | ||
className="p-6" | ||
onPress={() => | ||
navigation.dispatch(DrawerActions.toggleDrawer()) | ||
} | ||
> | ||
<PanelLeft className="text-black" /> | ||
</Pressable> | ||
); | ||
}, | ||
headerTitle: () => null, | ||
// drawerStyle: { | ||
// width: 240, | ||
// }, | ||
}} | ||
/> | ||
</GestureHandlerRootView> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from "react"; | ||
import { View } from "react-native"; | ||
import { Text } from "~/components/ui/text"; | ||
|
||
const Home: React.FC = () => { | ||
return ( | ||
<View className="flex flex-1 justify-center items-center"> | ||
<Text className="text-4xl">Welcome 🤗</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useLocalSearchParams } from "expo-router"; | ||
import React from "react"; | ||
import { View } from "react-native"; | ||
import sodium from "react-native-libsodium"; | ||
import { Text } from "~/components/ui/text"; | ||
import Document from "../../../components/document"; | ||
import { useLocker } from "../../../hooks/useLocker"; | ||
|
||
const List: React.FC = () => { | ||
const { listId } = useLocalSearchParams(); | ||
const documentId = typeof listId === "string" ? listId : null; | ||
|
||
const { content } = useLocker(); | ||
|
||
if (!documentId) { | ||
return ( | ||
<View> | ||
<Text>Document not found</Text> | ||
</View> | ||
); | ||
} | ||
|
||
const documentKeyBase64 = content[`document:${documentId}`]; | ||
|
||
if (!documentKeyBase64) { | ||
return ( | ||
<View> | ||
<Text>Loading document key …</Text> | ||
</View> | ||
); | ||
} | ||
|
||
const documentKey = sodium.from_base64(documentKeyBase64); | ||
|
||
return <Document documentId={documentId} documentKey={documentKey} />; | ||
}; | ||
|
||
export default List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.