chore: fix memos amount

This commit is contained in:
boojack 2022-07-05 22:09:11 +08:00
parent 592e037f21
commit 0e8d3e6907
5 changed files with 26 additions and 30 deletions

View File

@ -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>
</>

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -15,13 +15,7 @@ const memoSlice = createSlice({
setMemos: (state, action: PayloadAction<Memo[]>) => {
return {
...state,
memos: action.payload,
};
},
setTags: (state, action: PayloadAction<string[]>) => {
return {
...state,
tags: action.payload,
memos: action.payload.filter((m) => m.rowStatus === "NORMAL").sort((a, b) => b.createdTs - a.createdTs),
};
},
createMemo: (state, action: PayloadAction<Memo>) => {
@ -33,16 +27,24 @@ const memoSlice = createSlice({
patchMemo: (state, action: PayloadAction<Partial<Memo>>) => {
return {
...state,
memos: state.memos.map((m) => {
if (m.id === action.payload.id) {
return {
...m,
...action.payload,
};
} else {
return m;
}
}),
memos: state.memos
.map((memo) => {
if (memo.id === action.payload.id) {
return {
...memo,
...action.payload,
};
} else {
return memo;
}
})
.filter((memo) => memo.rowStatus === "NORMAL"),
};
},
setTags: (state, action: PayloadAction<string[]>) => {
return {
...state,
tags: action.payload,
};
},
},

View File

@ -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: [],
};