A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: improve inline announcement ui
thecodrrc089ae32ff0f
diff --git a/apps/web/src/common/db.js b/apps/web/src/common/db.jsindex 5457face5..233ef5e5d 100644--- a/apps/web/src/common/db.js+++ b/apps/web/src/common/db.js@@ -18,24 +18,24 @@ async function initializeDatabase() {db = new Database(Storage, EventSource, FS);// if (isTesting()) {- // db.host({- // API_HOST: "https://api.notesnook.com",- // AUTH_HOST: "https://auth.streetwriters.co",- // SSE_HOST: "https://events.streetwriters.co",- // });+ db.host({+ API_HOST: "https://api.notesnook.com",+ AUTH_HOST: "https://auth.streetwriters.co",+ SSE_HOST: "https://events.streetwriters.co",+ });// } else {// db.host({// API_HOST: "http://localhost:5264",// AUTH_HOST: "http://localhost:8264",// SSE_HOST: "http://localhost:7264",// });- db.host({- API_HOST: "http://192.168.10.29:5264",- AUTH_HOST: "http://192.168.10.29:8264",- SSE_HOST: "http://192.168.10.29:7264",- ISSUES_HOST: "http://192.168.10.29:2624",- SUBSCRIPTIONS_HOST: "http://192.168.10.29:9264",- });+ // db.host({+ // API_HOST: "http://192.168.10.29:5264",+ // AUTH_HOST: "http://192.168.10.29:8264",+ // SSE_HOST: "http://192.168.10.29:7264",+ // ISSUES_HOST: "http://192.168.10.29:2624",+ // SUBSCRIPTIONS_HOST: "http://192.168.10.29:9264",+ // });// }await db.init();diff --git a/apps/web/src/components/announcements/body.js b/apps/web/src/components/announcements/body.jsindex 0717d89c5..6254aebd4 100644--- a/apps/web/src/components/announcements/body.js+++ b/apps/web/src/components/announcements/body.js@@ -41,9 +41,23 @@ export default function AnnouncementBody({ id, components, type }) {switch (item.type) {case "title":- return <Title item={item} fontSize="subheading" />;+ return (+ <Title+ item={{ ...item, style: { ...item.style, textAlign: "left" } }}+ fontSize="subtitle"+ />+ );case "description":- return <Description item={item} />;+ return (+ <Description+ item={{+ ...item,+ style: { ...item.style, textAlign: "left", marginTop: 1 },+ }}+ fontSize="body"+ color="text"+ />+ );case "callToActions":return <InlineCalltoActions item={item} />;case "text":@@ -71,7 +85,7 @@ export default function AnnouncementBody({ id, components, type }) {case "subheading":return <Title item={item} fontSize={"title"} />;case "description":- return <Description item={item} />;+ return <Description item={item} fontSize="subtitle" />;case "callToActions":return <CalltoActions item={item} />;case "features":@@ -131,7 +145,7 @@ function Title({ item, fontSize }) {const { text, style } = item;return (<Text- value={text}+ value={text.toUpperCase()}variant="heading"mx={HORIZONTAL_MARGIN}fontSize={fontSize}@@ -140,14 +154,15 @@ function Title({ item, fontSize }) {);}-function Description({ item }) {+function Description({ item, fontSize, color }) {const { text, style } = item;return (<Textvalue={text}- variant="title"+ variant="body"fontWeight="normal"- color="fontTertiary"+ fontSize={fontSize}+ color={color || "fontTertiary"}mx={HORIZONTAL_MARGIN}sx={mapStyle(style)}/>@@ -180,7 +195,24 @@ function CalltoActions({ item }) {)).map((action, index) => (- <CalltoAction action={action} index={index} />+ <CalltoAction+ action={action}+ index={index}+ variant={+ index === 0+ ? "primary"+ : index === 1+ ? "secondary"+ : index === 2+ ? "tertiary"+ : "shade"+ }+ sx={{+ ":first-of-type": {+ mr: 1,+ },+ }}+ />))}</Flex>);@@ -189,12 +221,7 @@ function CalltoActions({ item }) {function InlineCalltoActions({ item }) {const { actions, style } = item;return (- <Flex- px={2}- justifyContent="center"- alignItems="center"- sx={mapStyle(style)}- >+ <Flex px={2} sx={mapStyle(style)}>{actions?.filter((cta) =>cta.platforms.some(@@ -202,31 +229,34 @@ function InlineCalltoActions({ item }) {)).map((action, index) => (- <CalltoAction key={action.title} action={action} index={index} />+ <CalltoAction+ key={action.title}+ action={action}+ variant={"anchor"}+ sx={{+ textDecoration: "underline",+ textDecorationLine: "underline",+ textDecorationColor:+ index === 0 ? "var(--dimPrimary)" : "var(--bgSecondary)",+ color: index === 0 ? "primary" : "fontTertiary",+ fontWeight: "bold",+ ":first-of-type": {+ mr: 1,+ },+ }}+ />))}</Flex>);}-function CalltoAction({ action, index }) {+function CalltoAction({ action, variant, sx }) {return (<Buttonas={action.type === "link" ? "a" : "button"}href={action.type === "link" ? action.data : ""}- variant={- index === 0- ? "primary"- : index === 1- ? "secondary"- : index === 2- ? "tertiary"- : "shade"- }- sx={{- ":first-of-type": {- mr: 1,- },- }}+ variant={variant}+ sx={sx}onClick={async () => {closeOpenedDialog();trackEvent(ANALYTICS_EVENTS.announcementCta, action.data);diff --git a/apps/web/src/components/announcements/index.js b/apps/web/src/components/announcements/index.jsindex 9ce70e466..51c9f10e1 100644--- a/apps/web/src/components/announcements/index.js+++ b/apps/web/src/components/announcements/index.js@@ -8,31 +8,36 @@ function Announcements({ announcements, removeAnnouncement }) {const announcement = useMemo(() => announcements[0], [announcements]);return (- <Flex flexDirection="column" mt={0} sx={{ borderRadius: "default" }}>- <Flex flex="1" justifyContent="end" alignItems="center" mx={2}>- <Text- bg="errorBg"- color="error"- //py={"1px"}- p="2px"- variant="subBody"- fontWeight="bold"- sx={{- borderRadius: 50,- cursor: "pointer",- ":hover": { opacity: 0.7 },- }}- onClick={() => {- trackEvent(- ANALYTICS_EVENTS.announcementDismissed,- announcement.title- );- removeAnnouncement && removeAnnouncement(announcement.id);- }}- >- <Icon.Cross color="error" size={16} />- </Text>- </Flex>+ <Flex+ flexDirection="column"+ mx={1}+ mb={2}+ py={2}+ bg="bgSecondary"+ sx={{ borderRadius: "default", position: "relative" }}+ >+ <Text+ bg="errorBg"+ p="2px"+ sx={{+ position: "absolute",+ right: 2,+ top: 2,+ borderRadius: 50,+ cursor: "pointer",+ alignSelf: "end",+ }}+ title="Dismiss announcement"+ onClick={() => {+ trackEvent(+ ANALYTICS_EVENTS.announcementDismissed,+ announcement.title+ );+ removeAnnouncement && removeAnnouncement(announcement.id);+ }}+ >+ <Icon.Cross color="error" size={16} />+ </Text><AnnouncementBody components={announcement.body} type="inline" /></Flex>);diff --git a/apps/web/src/components/group-header/index.js b/apps/web/src/components/group-header/index.jsindex f61054523..cd463fa66 100644--- a/apps/web/src/components/group-header/index.js+++ b/apps/web/src/components/group-header/index.js@@ -215,7 +215,7 @@ function GroupHeader(props) {><Textvariant="subtitle"- fontSize={isCompact ? "body" : "subtitle"}+ fontSize={"body"}color={title === "Conflicted" ? "error" : "primary"}>{title}