Skip to content

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

feat: minor ui fixes and add backup download

thecodrr484438e7d42f
diff --git a/apps/web/src/common/height-calculator.js b/apps/web/src/common/height-calculator.js
index ccb71b635..1249ebdce 100644
--- a/apps/web/src/common/height-calculator.js
+++ b/apps/web/src/common/height-calculator.js
@@ -10,7 +10,7 @@ const MAX_HEIGHTS = {
function getNoteHeight(item) {
const { title, headline } = item;
let height = SINGLE_LINE_HEIGHT * 3;
- if (title.length > 40) height += SINGLE_LINE_HEIGHT;
+ if (title.length > 30) height += SINGLE_LINE_HEIGHT;
if (headline.length > 0) height += SINGLE_LINE_HEIGHT;
if (headline.length > 40) height += SINGLE_LINE_HEIGHT;
return height * DEFAULT_FONT_SIZE;
@@ -21,7 +21,7 @@ function getNotebookHeight(item) {
// at the minimum we will have a title and the info text
let height = SINGLE_LINE_HEIGHT * 3; // 2.8 = 2 lines
- if (title.length > 40) {
+ if (title.length > 30) {
height += SINGLE_LINE_HEIGHT; // title has become multiline
}
@@ -33,7 +33,7 @@ function getNotebookHeight(item) {
height += SINGLE_LINE_HEIGHT;
}
- if (description?.length > 80) {
+ if (description?.length > 40) {
height += SINGLE_LINE_HEIGHT;
}
return height * DEFAULT_FONT_SIZE;
@@ -44,7 +44,7 @@ function getItemHeight(item) {
// at the minimum we will have a title and the info text
let height = SINGLE_LINE_HEIGHT * 3; // 2.8 = 2 lines
- if (title.length > 40) {
+ if (title.length > 30) {
height += SINGLE_LINE_HEIGHT; // title has become multiline
}
diff --git a/apps/web/src/theme/variants/button.js b/apps/web/src/theme/variants/button.js
index 6a902fd01..d811091ee 100644
--- a/apps/web/src/theme/variants/button.js
+++ b/apps/web/src/theme/variants/button.js
@@ -76,6 +76,7 @@ class List {
textAlign: "left",
py: 2,
px: 0,
+ cursor: "pointer",
":hover": {
borderBottomColor: "primary",
},
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 420d92eac..0aef762ef 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -8,6 +8,8 @@ import accents from "../theme/accents";
import { showLogInDialog } from "../components/dialogs/logindialog";
import { upgrade } from "../common/upgrade";
import useSystemTheme from "../utils/use-system-theme";
+import download from "../utils/download";
+import { db } from "../common";
function Settings(props) {
const theme = useThemeStore((store) => store.theme);
@@ -153,12 +155,24 @@ function Settings(props) {
<Text
variant="subtitle"
color="primary"
- sx={{ pb: 1, borderBottom: "1px solid", borderBottomColor: "border" }}
+ sx={{ py: 1, borderBottom: "1px solid", borderBottomColor: "border" }}
>
{"Backup & Restore"}
</Text>
- <Button variant="list">
- <TextWithTip text="Backup data" tip="Download all your data" />
+ <Button
+ variant="list"
+ onClick={async () => {
+ download(
+ `notesnook-backup-${new Date().toLocaleString("en")}`,
+ await db.backup.export(),
+ "nnbackup"
+ );
+ }}
+ >
+ <TextWithTip
+ text="Backup data"
+ tip="Backup and download all your data"
+ />
</Button>
<Button variant="list">
<TextWithTip
@@ -176,7 +190,7 @@ function Settings(props) {
<Text
variant="subtitle"
color="primary"
- sx={{ pb: 1, borderBottom: "1px solid", borderBottomColor: "border" }}
+ sx={{ py: 1, borderBottom: "1px solid", borderBottomColor: "border" }}
>
Other
</Text>
@@ -220,6 +234,12 @@ function ToggleItem(props) {
alignItems="center"
onClick={onToggled}
py={2}
+ sx={{
+ cursor: "pointer",
+ borderBottom: "1px solid",
+ borderBottomColor: "border",
+ ":hover": { borderBottomColor: "primary" },
+ }}
>
<TextWithTip text={title} tip={isToggled ? onTip : offTip} />
{isToggled ? (