-
-
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.
- Loading branch information
Showing
42 changed files
with
180 additions
and
96 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
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
File renamed without changes.
File renamed without changes.
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
6 changes: 4 additions & 2 deletions
6
client/src/media/files/base/FileGame.tsx → client/src/media/base/FileGame.tsx
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,34 @@ | ||
import {Image} from 'react-exo/image'; | ||
import {useStyles, createStyleSheet} from 'react-native-unistyles'; | ||
import {useFileUrl} from 'media/hooks/useFileUrl'; | ||
|
||
interface FileImage { | ||
path: string, | ||
name: string, | ||
maximized: boolean, | ||
} | ||
|
||
export function FileImage(props: FileImage) { | ||
const {styles} = useStyles(stylesheet); | ||
const urlImage = useFileUrl(props.path); | ||
|
||
return urlImage ? ( | ||
<Image | ||
url={urlImage} | ||
resizeMode={props.maximized ? 'contain' : 'cover'} | ||
style={[ | ||
styles.root, | ||
props.maximized && styles.maximized, | ||
]} | ||
/> | ||
) : null; | ||
} | ||
|
||
const stylesheet = createStyleSheet((theme) => ({ | ||
root: { | ||
flex: 1, | ||
}, | ||
maximized: { | ||
margin: theme.display.space3, | ||
}, | ||
})); |
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,27 @@ | ||
import {View} from 'react-native'; | ||
import {useStyles, createStyleSheet} from 'react-native-unistyles'; | ||
import {useFileText} from 'media/hooks/useFileText'; | ||
import {Markdown} from 'app/widgets/Markdown'; | ||
|
||
interface FileMarkdown { | ||
path: string, | ||
name: string, | ||
maximized: boolean, | ||
} | ||
|
||
export function FileMarkdown(props: FileMarkdown) { | ||
const {styles} = useStyles(stylesheet); | ||
const mdText = useFileText(props.path); | ||
|
||
return mdText ? ( | ||
<View style={styles.root}> | ||
<Markdown text={mdText}/> | ||
</View> | ||
) : null; | ||
} | ||
|
||
const stylesheet = createStyleSheet((theme) => ({ | ||
root: { | ||
margin: theme.display.space3, | ||
}, | ||
})); |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,17 @@ | ||
import {fs} from 'react-exo/fs'; | ||
import {useState, useEffect} from 'react'; | ||
|
||
export function useFileText(path: string) { | ||
const [text, setText] = useState<string>(); | ||
|
||
useEffect(() => { | ||
(async () => { | ||
const hfs = await fs.init(); | ||
const bytes = await hfs.bytes?.(path); | ||
if (!bytes) return; | ||
setText(new TextDecoder('utf-8').decode(bytes)); | ||
})(); | ||
}, [path]); | ||
|
||
return text; | ||
} |
4 changes: 2 additions & 2 deletions
4
...t/src/media/files/hooks/useFileDataURL.ts → client/src/media/hooks/useFileUrl.ts
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
client/src/media/files/hooks/useLists.ts → client/src/media/hooks/useLists.ts
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
2 changes: 1 addition & 1 deletion
2
client/src/media/files/hooks/useTasks.ts → client/src/media/hooks/useTasks.ts
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.