Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

ui: add empty placeholder for home

thecodrr876dcc1f588d
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index 411ee3605..75882817b 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -35,11 +35,15 @@ const NavMenuItem = props => {
};
function App() {
- const [selectedIndex, setSelectedIndex] = useState(1);
+ const [selectedIndex, setSelectedIndex] = useState(0);
return (
<ThemeProvider theme={theme}>
<Flex height="100%" alignContent="stretch">
- <Box width={[0, 0, 70]} bg="navbg" px={0}>
+ <Box
+ width={[0, 0, 70]}
+ sx={{ borderRight: "1px solid", borderRightColor: "navbg" }}
+ px={0}
+ >
{Object.values(routes).map((item, index) => (
<NavMenuItem
onSelected={() => {
diff --git a/apps/web/src/components/button/index.js b/apps/web/src/components/button/index.js
index 20704900d..904317ee0 100644
--- a/apps/web/src/components/button/index.js
+++ b/apps/web/src/components/button/index.js
@@ -5,7 +5,7 @@ import { ButtonPressedStyle } from "../../theme";
const Button = props => (
<Flex
bg="accent"
- width="full"
+ width={props.width || "full"}
py={3}
px={3}
flexDirection="row"
@@ -16,12 +16,14 @@ const Button = props => (
color: "fontSecondary",
fontFamily: "body",
fontWeight: "body",
- ...ButtonPressedStyle
+ boxShadow: "0 0 20px 0px #1790F3aa",
+ ...ButtonPressedStyle,
+ ...props.style
}}
onClick={props.onClick}
>
{props.Icon && <props.Icon />}
- <Text className="unselectable" mx={1}>
+ <Text as="span" className="unselectable" mx={1} flex="1 1 auto">
{props.content}
</Text>
</Flex>
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index 004ac5ab9..f757f50de 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -47,7 +47,7 @@ async function saveNote(quill) {
delta: quill.getContents(),
text: quill.getText()
};
- if (!content.delta || content.text.len <= 1) return;
+ if (!content.delta || content.text.length <= 1) return;
let note = {
content,
title,
diff --git a/apps/web/src/theme.js b/apps/web/src/theme.js
index e22b86891..4e6e28a5a 100644
--- a/apps/web/src/theme.js
+++ b/apps/web/src/theme.js
@@ -20,9 +20,9 @@ export default {
},
space: [0, 5, 10, 12],
fontSizes: {
- heading: 42,
+ heading: 36,
input: 16,
- title: 28,
+ title: 22,
subtitle: 18,
body: 14,
menu: 14
diff --git a/apps/web/src/views/Home.js b/apps/web/src/views/Home.js
index 146b89a3f..6150c6e46 100644
--- a/apps/web/src/views/Home.js
+++ b/apps/web/src/views/Home.js
@@ -53,64 +53,86 @@ function Home() {
}, []);
return (
<Flex flexDirection="column" flex="1 1 auto">
- <Search placeholder="Search" />
- <Button
- Icon={Icon.Plus}
- content="Make a new note"
- onClick={sendNewNoteEvent}
- />
- <List
- style={{ width: "100%", flex: "1 1 auto", height: "auto" }}
- totalCount={notes.length}
- item={index => {
- const note = notes[index];
- return (
- <Box
- bg="navbg"
- px={3}
- py={3}
- sx={{
- borderRadius: "default",
- marginBottom: 2,
- ...ButtonPressedStyle
- }}
- >
- <Flex flexDirection="row" justifyContent="space-between">
- <Text fontFamily="body" fontSize="title" fontWeight="bold">
- {note.title}
- </Text>
- <Dropdown ref={ref => (dropdownRefs[index] = ref)}>
- <DropdownTrigger>
- <Icon.MoreVertical
- size={20}
- strokeWidth={1.5}
- style={{ marginRight: -5 }}
- />
- </DropdownTrigger>
- <DropdownContent style={{ zIndex: 999, marginLeft: -70 }}>
- <Menu
- dropdownRef={dropdownRefs[index]}
- menuItems={menuItems}
- data={note}
- />
- </DropdownContent>
- </Dropdown>
- </Flex>
- <Text fontFamily="body" fontSize="body" sx={{ marginTop: 1 }}>
- {note.headline}
- </Text>
- <Text
- fontFamily="body"
- fontWeight="body"
- fontSize={12}
- color="accent"
- >
- <TimeAgo datetime={note.dateCreated} />
- </Text>
- </Box>
- );
- }}
- />
+ {notes.length > 0 ? (
+ <Flex flexDirection="column" flex="1 1 auto">
+ <Search placeholder="Search" />
+ <List
+ style={{ width: "100%", flex: "1 1 auto", height: "auto" }}
+ totalCount={notes.length}
+ item={index => {
+ const note = notes[index];
+ return (
+ <Box
+ bg="navbg"
+ px={3}
+ py={3}
+ sx={{
+ borderRadius: "default",
+ marginBottom: 2,
+ ...ButtonPressedStyle
+ }}
+ >
+ <Flex flexDirection="row" justifyContent="space-between">
+ <Text fontFamily="body" fontSize="title" fontWeight="bold">
+ {note.title}
+ </Text>
+ <Dropdown ref={ref => (dropdownRefs[index] = ref)}>
+ <DropdownTrigger>
+ <Icon.MoreVertical
+ size={20}
+ strokeWidth={1.5}
+ style={{ marginRight: -5 }}
+ />
+ </DropdownTrigger>
+ <DropdownContent style={{ zIndex: 999, marginLeft: -70 }}>
+ <Menu
+ dropdownRef={dropdownRefs[index]}
+ menuItems={menuItems}
+ data={note}
+ />
+ </DropdownContent>
+ </Dropdown>
+ </Flex>
+ <Text fontFamily="body" fontSize="body" sx={{ marginTop: 1 }}>
+ {note.headline}
+ </Text>
+ <Text
+ fontFamily="body"
+ fontWeight="body"
+ fontSize={12}
+ color="accent"
+ >
+ <TimeAgo datetime={note.dateCreated} />
+ </Text>
+ </Box>
+ );
+ }}
+ />
+ <Button
+ Icon={Icon.Plus}
+ content="Make a new note"
+ onClick={sendNewNoteEvent}
+ />
+ </Flex>
+ ) : (
+ <Flex
+ flex="1 1 auto"
+ alignItems="center"
+ justifyContent="center"
+ color="#9b9b9b"
+ flexDirection="column"
+ >
+ <Icon.Edit size={72} strokeWidth={1.5} />
+ <Text variant="title">You have no notes</Text>
+ <Button
+ Icon={Icon.Edit2}
+ onClick={sendNewNoteEvent}
+ content="Let's begin"
+ style={{ marginTop: 2, textAlign: "center" }}
+ width={"auto"}
+ />
+ </Flex>
+ )}
</Flex>
);
}
diff --git a/apps/web/src/views/Notebooks.js b/apps/web/src/views/Notebooks.js
index 35ec32ed0..a3f649c8e 100644
--- a/apps/web/src/views/Notebooks.js
+++ b/apps/web/src/views/Notebooks.js
@@ -19,11 +19,6 @@ const Notebooks = props => {
return (
<Flex flexDirection="column">
<Search placeholder="Search" />
- <Button
- Icon={Icon.Plus}
- content="Create a notebook"
- onClick={() => setOpen(true)}
- />
<Flex
flexDirection="row"
bg={"primary"}
@@ -51,6 +46,12 @@ const Notebooks = props => {
</Box>
<Text className="unselectable">{notebook.totalNotes} Notes</Text>
</Flex>
+
+ <Button
+ Icon={Icon.Plus}
+ content="Create a notebook"
+ onClick={() => setOpen(true)}
+ />
<CreateNotebookDialog open={open} close={() => setOpen(false)} />
</Flex>
);