Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix memos amount

boojack0e8d3e6907c2
diff --git a/web/src/components/Settings/MyAccountSection.tsx b/web/src/components/Settings/MyAccountSection.tsx
index b9bace93e..efed1aebd 100644
--- a/web/src/components/Settings/MyAccountSection.tsx
+++ b/web/src/components/Settings/MyAccountSection.tsx
@@ -19,7 +19,7 @@ interface Props {}
const MyAccountSection: React.FC<Props> = () => {
const user = useAppSelector((state) => state.user.user as User);
const [username, setUsername] = useState<string>(user.name);
- const openAPIRoute = `${window.location.origin}/h/${user.openId}/memo`;
+ const openAPIRoute = `${window.location.origin}/api/memo?openId=${user.openId}`;
const handleUsernameChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
const nextUsername = e.target.value as string;
@@ -100,7 +100,7 @@ const MyAccountSection: React.FC<Props> = () => {
</span>
<div className="usage-guide-container">
<p className="title-text">Usage guide:</p>
- <pre>{`POST ${openAPIRoute}\nContent-type: application/json\n{\n "content": "Hello, #memos ${window.location.origin}"\n}`}</pre>
+ <pre>{`POST ${openAPIRoute}\nContent-type: application/json\n{\n "content": "Hello #memos from ${window.location.origin}"\n}`}</pre>
</div>
</div>
</>
diff --git a/web/src/less/editor.less b/web/src/less/editor.less
index 79e170d18..9f8b1b315 100644
--- a/web/src/less/editor.less
+++ b/web/src/less/editor.less
@@ -29,7 +29,7 @@
@apply flex flex-row justify-start items-center;
> .action-btn {
- @apply flex flex-row justify-start items-center p-1 w-auto h-auto mr-1 select-none rounded cursor-pointer opacity-60 hover:opacity-80 hover:bg-gray-300 hover:shadow;
+ @apply flex flex-row justify-start items-center p-1 w-auto h-auto mr-1 select-none rounded cursor-pointer opacity-60 hover:opacity-90 hover:bg-gray-300 hover:shadow;
> .icon-img {
@apply w-5 h-auto;
@@ -49,7 +49,7 @@
}
> .tag-list {
- @apply hidden flex-col justify-start items-start absolute top-6 left-0 p-1 z-10 rounded w-32 max-h-52 overflow-auto bg-black;
+ @apply hidden flex-col justify-start items-start absolute top-6 left-0 mt-1 p-1 z-10 rounded w-32 max-h-52 overflow-auto bg-black;
> span {
@apply w-full text-white cursor-pointer rounded text-sm leading-6 px-2 hover:bg-gray-700;
diff --git a/web/src/less/setting-dialog.less b/web/src/less/setting-dialog.less
index 0361f5dfa..91262817b 100644
--- a/web/src/less/setting-dialog.less
+++ b/web/src/less/setting-dialog.less
@@ -4,7 +4,7 @@
@apply px-4;
> .dialog-container {
- @apply w-176 max-w-full mb-8 p-0;
+ @apply w-180 max-w-full mb-8 p-0;
> .dialog-content-container {
.flex(column, flex-start, flex-start);
@@ -38,7 +38,7 @@
}
> .icon-text {
- @apply text-base mr-1;
+ @apply text-base mr-2;
}
}
}
diff --git a/web/src/store/modules/memo.ts b/web/src/store/modules/memo.ts
index 1e4808259..278e52b3f 100644
--- a/web/src/store/modules/memo.ts
+++ b/web/src/store/modules/memo.ts
@@ -15,34 +15,36 @@ const memoSlice = createSlice({
setMemos: (state, action: PayloadAction<Memo[]>) => {
return {
...state,
- memos: action.payload,
+ memos: action.payload.filter((m) => m.rowStatus === "NORMAL").sort((a, b) => b.createdTs - a.createdTs),
};
},
- setTags: (state, action: PayloadAction<string[]>) => {
+ createMemo: (state, action: PayloadAction<Memo>) => {
return {
...state,
- tags: action.payload,
+ memos: state.memos.concat(action.payload).sort((a, b) => b.createdTs - a.createdTs),
};
},
- createMemo: (state, action: PayloadAction<Memo>) => {
+ patchMemo: (state, action: PayloadAction<Partial<Memo>>) => {
return {
...state,
- memos: state.memos.concat(action.payload).sort((a, b) => b.createdTs - a.createdTs),
+ memos: state.memos
+ .map((memo) => {
+ if (memo.id === action.payload.id) {
+ return {
+ ...memo,
+ ...action.payload,
+ };
+ } else {
+ return memo;
+ }
+ })
+ .filter((memo) => memo.rowStatus === "NORMAL"),
};
},
- patchMemo: (state, action: PayloadAction<Partial<Memo>>) => {
+ setTags: (state, action: PayloadAction<string[]>) => {
return {
...state,
- memos: state.memos.map((m) => {
- if (m.id === action.payload.id) {
- return {
- ...m,
- ...action.payload,
- };
- } else {
- return m;
- }
- }),
+ tags: action.payload,
};
},
},
diff --git a/web/tailwind.config.js b/web/tailwind.config.js
index abec876a3..87c1a9c63 100644
--- a/web/tailwind.config.js
+++ b/web/tailwind.config.js
@@ -16,18 +16,12 @@ module.exports = {
spacing: {
112: "28rem",
128: "32rem",
- 168: "42rem",
- 176: "44rem",
- 200: "50rem",
+ 180: "45rem",
},
zIndex: {
100: "100",
1000: "1000",
},
- gridTemplateRows: {
- 7: "repeat(7, minmax(0, 1fr))",
- },
},
},
- plugins: [],
};