feat: do not treat General topic specially

This commit is contained in:
thecodrr
2021-04-28 12:45:30 +05:00
parent fd2c325537
commit b20a41bf21
4 changed files with 69 additions and 54 deletions

View File

@@ -11,7 +11,7 @@ class AddNotebookDialog extends React.Component {
id = undefined;
deletedTopics = [];
state = {
topics: [{ title: "General" }],
topics: [],
isEditting: false,
editIndex: -1,
};
@@ -177,7 +177,6 @@ class AddNotebookDialog extends React.Component {
{this.state.topics.map((topic, index) => (
<TopicItem
key={topic.id || topic.title || index}
hideActions={topic.title === "General"}
title={topic.title}
isEditing={this.state.editIndex === index}
onEdit={() => this.editTopic(index)}

View File

@@ -34,31 +34,28 @@ class Notebook extends React.Component {
footer={
<>
<Flex sx={{ marginBottom: 1, marginTop: 1 }}>
{notebook?.topics
?.filter((v) => v.title !== "General")
.slice(0, 3)
.map((topic) => (
<Flex
key={topic.id}
onClick={(e) => {
onTopicClick(notebook, topic.id);
e.stopPropagation();
}}
bg="primary"
px={1}
sx={{
marginRight: 1,
borderRadius: "default",
color: "static",
paddingTop: "2px",
paddingBottom: "2px",
}}
>
<Text variant="body" color="static" fontSize={11}>
{topic.title}
</Text>
</Flex>
))}
{notebook?.topics.slice(0, 3).map((topic) => (
<Flex
key={topic.id}
onClick={(e) => {
onTopicClick(notebook, topic.id);
e.stopPropagation();
}}
bg="primary"
px={1}
sx={{
marginRight: 1,
borderRadius: "default",
color: "static",
paddingTop: "2px",
paddingBottom: "2px",
}}
>
<Text variant="body" color="static" fontSize={11}>
{topic.title}
</Text>
</Flex>
))}
</Flex>
<Flex sx={{ fontSize: "subBody", color: "fontTertiary" }}>
{notebook.pinned && (

View File

@@ -21,7 +21,7 @@ function Topic({ item, index, onClick }) {
}
index={index}
menu={{
items: topic.title === "General" ? generalTopicMenuItems : menuItems,
items: menuItems,
extraData: { topic },
}}
/>

View File

@@ -2540,7 +2540,7 @@
abab@^2.0.3:
version "2.0.5"
resolved "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a"
integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==
accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7:
@@ -2576,7 +2576,7 @@ acorn-walk@^8.0.0:
acorn@^6.4.1:
version "6.4.2"
resolved "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6"
integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==
acorn@^7.1.0, acorn@^7.1.1, acorn@^7.4.0:
@@ -4594,7 +4594,7 @@ cssom@^0.4.4:
cssom@~0.3.6:
version "0.3.8"
resolved "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz"
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a"
integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==
cssstyle@^2.2.0:
@@ -4997,11 +4997,6 @@ domhandler@^2.3.0:
dependencies:
domelementtype "1"
domino@^2.1.6:
version "2.1.6"
resolved "https://registry.npmjs.org/domino/-/domino-2.1.6.tgz"
integrity sha512-3VdM/SXBZX2omc9JF9nOPCtDaYQ67BGp5CoLpIQlO2KCAPETs8TcDHacF26jXadGbvUteZzRTeos2fhID5+ucQ==
domutils@^1.5.1, domutils@^1.7.0:
version "1.7.0"
resolved "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz"
@@ -5409,7 +5404,7 @@ escape-string-regexp@^4.0.0:
escodegen@^1.14.1:
version "1.14.3"
resolved "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503"
integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==
dependencies:
esprima "^4.0.1"
@@ -9112,16 +9107,16 @@ normalize-url@^4.1.0:
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==
"notes-core@git+https://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:x-oauth-basic@github.com/streetwriters/notesnook-core.git":
version "6.6.5"
resolved "git+https://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:x-oauth-basic@github.com/streetwriters/notesnook-core.git#7f270586c7884f5da0b2aeea28be1b605c7b1dbf"
version "6.6.6"
resolved "git+https://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:x-oauth-basic@github.com/streetwriters/notesnook-core.git#0a2895433d3bc34b93705bd6dea17839f6ac3a2b"
dependencies:
fast-sort "^2.0.1"
lean-he "^2.1.2"
no-internet "^1.5.2"
qclone "^1.0.4"
quill-delta-to-html "^0.12.0"
showdown "https://github.com/thecodrr/showdown"
spark-md5 "^3.0.1"
turndown "^7.0.0"
npm-conf@^1.1.3:
version "1.1.3"
@@ -9159,7 +9154,7 @@ num2fraction@^1.2.2:
nwsapi@^2.2.0:
version "2.2.0"
resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz"
resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7"
integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==
nyc@^15.1.0:
@@ -11329,7 +11324,7 @@ request-promise-core@1.1.4:
request-promise-native@^1.0.8:
version "1.0.9"
resolved "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz"
resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.9.tgz#e407120526a5efdc9a39b28a5679bf47b9d9dc28"
integrity sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==
dependencies:
request-promise-core "1.1.4"
@@ -11338,7 +11333,7 @@ request-promise-native@^1.0.8:
request@^2.88.2:
version "2.88.2"
resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz"
resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3"
integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==
dependencies:
aws-sign2 "~0.7.0"
@@ -11914,6 +11909,12 @@ shellwords@^0.1.1:
resolved "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz"
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
"showdown@https://github.com/thecodrr/showdown":
version "2.0.0-alpha1"
resolved "https://github.com/thecodrr/showdown#416cbdfd09b87886360ed162503ac144524e7fae"
dependencies:
yargs "14.2.0"
side-channel@^1.0.3, side-channel@^1.0.4:
version "1.0.4"
resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz"
@@ -12581,7 +12582,7 @@ svgo@^1.0.0, svgo@^1.2.2:
symbol-tree@^3.2.4:
version "3.2.4"
resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
table@^6.0.4:
@@ -12920,13 +12921,6 @@ tunnel@^0.0.6:
resolved "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz"
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==
turndown@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/turndown/-/turndown-7.0.0.tgz"
integrity sha512-G1FfxfR0mUNMeGjszLYl3kxtopC4O9DRRiMlMDDVHvU1jaBkGFg4qxIyjIk2aiKLHyDyZvZyu4qBO2guuYBy3Q==
dependencies:
domino "^2.1.6"
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz"
@@ -13316,7 +13310,7 @@ vm-browserify@^1.0.1:
w3c-hr-time@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz"
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"
integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==
dependencies:
browser-process-hrtime "^1.0.0"
@@ -13540,7 +13534,7 @@ websocket-extensions@>=0.1.1:
whatwg-encoding@^1.0.5:
version "1.0.5"
resolved "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz"
resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0"
integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==
dependencies:
iconv-lite "0.4.24"
@@ -13552,7 +13546,7 @@ whatwg-fetch@^3.4.1:
whatwg-mimetype@^2.3.0:
version "2.3.0"
resolved "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz"
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==
whatwg-url@^8.0.0:
@@ -13889,6 +13883,14 @@ yargs-parser@^13.1.2:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-parser@^15.0.0:
version "15.0.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.1.tgz#54786af40b820dcb2fb8025b11b4d659d76323b3"
integrity sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==
dependencies:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-parser@^18.1.2:
version "18.1.3"
resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz"
@@ -13902,6 +13904,23 @@ yargs-parser@^20.2.2:
resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz"
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
yargs@14.2.0:
version "14.2.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.0.tgz#f116a9242c4ed8668790b40759b4906c276e76c3"
integrity sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg==
dependencies:
cliui "^5.0.0"
decamelize "^1.2.0"
find-up "^3.0.0"
get-caller-file "^2.0.1"
require-directory "^2.1.1"
require-main-filename "^2.0.0"
set-blocking "^2.0.0"
string-width "^3.0.0"
which-module "^2.0.0"
y18n "^4.0.0"
yargs-parser "^15.0.0"
yargs@^13.3.2:
version "13.3.2"
resolved "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz"