From 3c650187c5fa71863c319acc567ce2e5e35d75f1 Mon Sep 17 00:00:00 2001 From: Sung Won Cho Date: Sat, 11 Jan 2020 17:19:59 +1000 Subject: [PATCH 001/131] Update README (#390) * Update README * Update wording --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4eee89b6..eafc20c5 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ [![Build Status](https://travis-ci.org/dnote/dnote.svg?branch=master)](https://travis-ci.org/dnote/dnote) -[Dnote](https://www.getdnote.com) is a lightweight personal knowledge base. The main design goal is to **keep you focused** by providing a way of swiftly capturing new information **without having to switch environment**. To that end, you can use Dnote as a command-line interface, browser extension, web client, or an IDE plugin. +[Dnote](https://www.getdnote.com) is a lightweight personal knowledge base for programmers. The main design goal is to **keep you focused** by providing a way of swiftly capturing new information **without having to switch environment**. To that end, you can use Dnote as a [command-line interface](https://github.com/dnote/dnote/blob/master/pkg/cli/README.md), browser extension, web client, or an IDE plugin. It also offers a seamless **multi-device sync**, and **automated spaced repetition** to retain your memory. For more information, please see [features](https://www.getdnote.com/pricing). -![Dnote web application running on various devices](assets/devices.png "Dnote web application running on various devices") +![A demo of Dnote command line interface](assets/cli.gif "Dnote command line interface") ## Get Started @@ -15,6 +15,8 @@ The quickest way to try Dnote is to use the hosted version at https://app.getdno Alternatively, you can self-host a Dnote server by either [using Docker](https://github.com/dnote/dnote/blob/master/host/docker/README.md) or [using a binary](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md). +![Dnote web application running on various devices](assets/devices.png "Dnote web application running on various devices") + ## Dnote clients You can use the following client programs to interact with Dnote: From e6b5aea147911005aa4e1a0def9ad2ff6e6801b8 Mon Sep 17 00:00:00 2001 From: Sung Won Cho Date: Fri, 31 Jan 2020 08:49:12 +1000 Subject: [PATCH 002/131] Add client field (#396) * Record client * Fix test --- pkg/server/app/notes.go | 3 ++- pkg/server/app/notes_test.go | 2 +- pkg/server/database/models.go | 1 + pkg/server/handlers/routes.go | 1 + pkg/server/handlers/v3_notes.go | 3 ++- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/server/app/notes.go b/pkg/server/app/notes.go index 3a3c5ccf..9a6022bb 100644 --- a/pkg/server/app/notes.go +++ b/pkg/server/app/notes.go @@ -27,7 +27,7 @@ import ( // CreateNote creates a note with the next usn and updates the user's max_usn. // It returns the created note. -func (a *App) CreateNote(user database.User, bookUUID, content string, addedOn *int64, editedOn *int64, public bool) (database.Note, error) { +func (a *App) CreateNote(user database.User, bookUUID, content string, addedOn *int64, editedOn *int64, public bool, origin string) (database.Note, error) { tx := a.DB.Begin() nextUSN, err := incrementUserUSN(tx, user.ID) @@ -65,6 +65,7 @@ func (a *App) CreateNote(user database.User, bookUUID, content string, addedOn * Body: content, Public: public, Encrypted: false, + Client: origin, } if err := tx.Create(¬e).Error; err != nil { tx.Rollback() diff --git a/pkg/server/app/notes_test.go b/pkg/server/app/notes_test.go index 557ae218..d15fbf74 100644 --- a/pkg/server/app/notes_test.go +++ b/pkg/server/app/notes_test.go @@ -90,7 +90,7 @@ func TestCreateNote(t *testing.T) { }) tx := testutils.DB.Begin() - if _, err := a.CreateNote(user, b1.UUID, "note content", tc.addedOn, tc.editedOn, false); err != nil { + if _, err := a.CreateNote(user, b1.UUID, "note content", tc.addedOn, tc.editedOn, false, ""); err != nil { tx.Rollback() t.Fatal(errors.Wrap(err, "deleting note")) } diff --git a/pkg/server/database/models.go b/pkg/server/database/models.go index 8684ae2d..9414834d 100644 --- a/pkg/server/database/models.go +++ b/pkg/server/database/models.go @@ -60,6 +60,7 @@ type Note struct { Deleted bool `json:"-" gorm:"default:false"` Encrypted bool `json:"-" gorm:"default:false"` NoteReview NoteReview `json:"-"` + Client string `gorm:"index"` } // User is a model for a user diff --git a/pkg/server/handlers/routes.go b/pkg/server/handlers/routes.go index 2368df42..c3a69961 100644 --- a/pkg/server/handlers/routes.go +++ b/pkg/server/handlers/routes.go @@ -281,6 +281,7 @@ func logging(inner http.Handler) http.HandlerFunc { inner.ServeHTTP(&lw, r) log.WithFields(log.Fields{ + "origin": r.Header.Get("Origin"), "remoteAddr": lookupIP(r), "uri": r.RequestURI, "statusCode": lw.statusCode, diff --git a/pkg/server/handlers/v3_notes.go b/pkg/server/handlers/v3_notes.go index bef8d23f..8d1657ef 100644 --- a/pkg/server/handlers/v3_notes.go +++ b/pkg/server/handlers/v3_notes.go @@ -195,7 +195,8 @@ func (a *API) CreateNote(w http.ResponseWriter, r *http.Request) { return } - note, err := a.App.CreateNote(user, params.BookUUID, params.Content, params.AddedOn, params.EditedOn, false) + origin := r.Header.Get("Origin") + note, err := a.App.CreateNote(user, params.BookUUID, params.Content, params.AddedOn, params.EditedOn, false, origin) if err != nil { HandleError(w, "creating note", err, http.StatusInternalServerError) return From b92bff942bf97c2a90938a4875bf96ca0db5b287 Mon Sep 17 00:00:00 2001 From: Sung Won Cho Date: Mon, 3 Feb 2020 14:29:42 +1000 Subject: [PATCH 003/131] Deprecate spaced repetition (#397) * Change button style * Require pro * Update README * Change wording * Require sudo --- CHANGELOG.md | 3 +- README.md | 44 ++---- pkg/cli/install.sh => install.sh | 19 ++- pkg/cli/README.md | 34 +---- pkg/server/README.md | 4 +- pkg/server/database/models.go | 2 +- pkg/server/handlers/routes.go | 20 +-- pkg/server/handlers/subscription.go | 2 +- .../src/subscription_confirmation.txt | 8 +- pkg/server/mailer/templates/src/welcome.txt | 4 +- web/src/components/App/_buttons.scss | 4 +- web/src/components/Books/index.tsx | 29 ++-- web/src/components/Common/PayWall.tsx | 10 +- web/src/components/Digests/index.tsx | 11 +- web/src/components/Header/Nav/index.tsx | 9 +- .../SearchBar/AdvancedPanel/BookSearch.tsx | 10 +- .../SearchBar/AdvancedPanel/WordsSearch.tsx | 8 +- .../Header/SearchBar/AdvancedPanel/index.tsx | 7 +- web/src/components/Header/SearchBar/index.tsx | 11 +- web/src/components/Home/index.tsx | 13 +- web/src/components/New/Content.tsx | 5 - web/src/components/New/index.tsx | 10 +- web/src/components/Repetition/Content.tsx | 7 +- .../Settings/Notifications/Form.tsx | 25 ---- .../components/Subscription/Checkout/Form.tsx | 2 +- .../Subscription/Checkout/Sidebar.tsx | 7 +- .../Subscription/Checkout/index.tsx | 14 ++ .../components/Subscription/FeatureItem.scss | 39 ----- .../components/Subscription/FeatureItem.tsx | 38 ----- .../components/Subscription/FeatureList.scss | 28 ---- .../components/Subscription/FeatureList.tsx | 43 ------ web/src/components/Subscription/Footer.tsx | 4 +- web/src/components/Subscription/Plan/Core.tsx | 58 -------- .../components/Subscription/Plan/Plan.scss | 100 ------------- web/src/components/Subscription/Plan/Pro.tsx | 52 ------- .../components/Subscription/Plan/ProCTA.tsx | 57 -------- .../components/Subscription/Plan/internal.tsx | 75 ---------- .../components/Subscription/Subscription.scss | 29 ---- web/src/components/Subscription/index.tsx | 138 ------------------ web/src/libs/paths.ts | 11 +- web/src/routes.tsx | 11 -- 41 files changed, 149 insertions(+), 856 deletions(-) rename pkg/cli/install.sh => install.sh (90%) delete mode 100644 web/src/components/Subscription/FeatureItem.scss delete mode 100644 web/src/components/Subscription/FeatureItem.tsx delete mode 100644 web/src/components/Subscription/FeatureList.scss delete mode 100644 web/src/components/Subscription/FeatureList.tsx delete mode 100644 web/src/components/Subscription/Plan/Core.tsx delete mode 100644 web/src/components/Subscription/Plan/Plan.scss delete mode 100644 web/src/components/Subscription/Plan/Pro.tsx delete mode 100644 web/src/components/Subscription/Plan/ProCTA.tsx delete mode 100644 web/src/components/Subscription/Plan/internal.tsx delete mode 100644 web/src/components/Subscription/index.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c980dc9..85167757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ The following log documents the history of the server project. ### Unreleased -None +- Deprecate the digests +- Deprecate the repetition rules ### 0.4.0 - 2020-01-09 diff --git a/README.md b/README.md index eafc20c5..1cf73841 100644 --- a/README.md +++ b/README.md @@ -3,49 +3,35 @@ [![Build Status](https://travis-ci.org/dnote/dnote.svg?branch=master)](https://travis-ci.org/dnote/dnote) -[Dnote](https://www.getdnote.com) is a lightweight personal knowledge base for programmers. The main design goal is to **keep you focused** by providing a way of swiftly capturing new information **without having to switch environment**. To that end, you can use Dnote as a [command-line interface](https://github.com/dnote/dnote/blob/master/pkg/cli/README.md), browser extension, web client, or an IDE plugin. +[Dnote](https://www.getdnote.com) is a simple command line notebook for programmers. -It also offers a seamless **multi-device sync**, and **automated spaced repetition** to retain your memory. For more information, please see [features](https://www.getdnote.com/pricing). +It **keeps you focused** by providing a way of effortlessly capturing new information **without leaving your terminal**. It also offers a seamless **multi-device sync** and **web application**. ![A demo of Dnote command line interface](assets/cli.gif "Dnote command line interface") -## Get Started +## Installation -The quickest way to try Dnote is to use the hosted version at https://app.getdnote.com +On macOS, you can install using Homebrew: -Alternatively, you can self-host a Dnote server by either [using Docker](https://github.com/dnote/dnote/blob/master/host/docker/README.md) or [using a binary](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md). +```sh +brew tap dnote/dnote +brew install dnote +``` -![Dnote web application running on various devices](assets/devices.png "Dnote web application running on various devices") +On Linux or macOS, you can use the installation script: -## Dnote clients + curl -s https://getdnote.com/install | sh -You can use the following client programs to interact with Dnote: +Otherwise, you can download the binary for your platform manually from the [releases page](https://github.com/dnote/dnote/releases). -* [Command line interface](https://github.com/dnote/dnote/blob/master/pkg/cli/README.md) -* Chrome browser extension -* Firefox addon -* [Web interface](https://app.getdnote.com) -* Atom plugin +## Server -For the installation guide, please see the [download page](https://www.getdnote.com/download). +The quickest way to experience the Dnote server is to use [Dnote Cloud](https://app.getdnote.com). -## What is a personal knowledge base? - -A personal knowledge base is a tool used to capture the knowledge of an individual and retrieve it later. - -Dnote is great for building a personal knowledge base because: - -* [It is fully open-source](https://www.getdnote.com/blog/open-sourcing-dnote). -* You own your data locally using a SQLite format which is [suitable for continued accessibility](https://www.sqlite.org/locrsf.html). -* It provides a way of instantly capturing new lessons without distracting you. -* It automates spaced repetition to help you retain your memory. - -You can read more in the following user stories: - -- [How I Built a Personal Knowledge Base for Myself](https://www.getdnote.com/blog/how-i-built-personal-knowledge-base-for-myself/) -- [I Wrote Down Everything I Learned While Programming for a Month](https://www.getdnote.com/blog/writing-everything-i-learn-coding-for-a-month/) +Or you can install it on your server by [using Docker](https://github.com/dnote/dnote/blob/master/host/docker/README.md), or [using a binary](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md). ## See Also - [Homepage](https://www.getdnote.com) - [Forum](https://forum.getdnote.com) +- [I Wrote Down Everything I Learned While Programming for a Month](https://www.getdnote.com/blog/writing-everything-i-learn-coding-for-a-month/) diff --git a/pkg/cli/install.sh b/install.sh similarity index 90% rename from pkg/cli/install.sh rename to install.sh index 3eb19d14..18460066 100755 --- a/pkg/cli/install.sh +++ b/install.sh @@ -131,6 +131,8 @@ verify_checksum() { } install_dnote() { + sudo_cmd="" + os=$(uname_os) arch=$(uname_arch) @@ -147,6 +149,18 @@ install_dnote() { tmpdir="$(mktemp -d)" bindir=${bindir:-/usr/local/bin} + if hash sudo 2>/dev/null; then + sudo_cmd="sudo" + echo "You need a root privilege to install Dnote binary to $bindir" + + if ! is_command "$sudo_cmd"; then + print_error "command not found: sudo. You need a root privilege to continue the installation." + exit 1; + fi + fi + + # create destination directory if not exists + $sudo_cmd mkdir -p "$bindir" # get the latest version resp=$(http_get "https://api.github.com/repos/$owner/$repo/releases") @@ -181,13 +195,12 @@ install_dnote() { print_step "Inflating the binary." (cd "${tmpdir}" && tar -xzf "${tarball}") - install -d "${bindir}" - install "${tmpdir}/${binary}" "${bindir}/" + $sudo_cmd install -d "${bindir}" + $sudo_cmd install "${tmpdir}/${binary}" "${bindir}/" print_success "dnote v${version} was successfully installed in $bindir." } - exit_error() { # shellcheck disable=SC2181 if [ "$?" -ne 0 ]; then diff --git a/pkg/cli/README.md b/pkg/cli/README.md index 2d3df4ad..d177e902 100644 --- a/pkg/cli/README.md +++ b/pkg/cli/README.md @@ -1,33 +1 @@ -# Dnote CLI - -A simple command line interface for Dnote. - -![Dnote](/assets/cli.gif) - -It is Designed to minimize environment switching for taking notes. - -## Install - -On macOS, you can install using Homebrew: - -```sh -brew tap dnote/dnote -brew install dnote - -# to upgrade to the latest version -brew upgrade dnote -``` - -On Linux or macOS, you can use the installation script: - - curl -s https://raw.githubusercontent.com/dnote/dnote/master/pkg/cli/install.sh | sh - -In some cases, you might need an elevated permission: - - curl -s https://raw.githubusercontent.com/dnote/dnote/master/pkg/cli/install.sh | sudo sh - -Otherwise, you can download the binary for your platform manually from the [releases page](https://github.com/dnote/dnote/releases). - -## Commands - -Please refer to [commands](./COMMANDS.md). +This directory contains the command line interface project for Dnote. diff --git a/pkg/server/README.md b/pkg/server/README.md index 1f10f8f0..bf8bb4fd 100644 --- a/pkg/server/README.md +++ b/pkg/server/README.md @@ -1,3 +1 @@ -# Dnote Server - -The Dnote server containing the web interface, the web API, and the background jobs. +This directory contains the Dnote server. It comprises of the web interface, the web API, and the background jobs. diff --git a/pkg/server/database/models.go b/pkg/server/database/models.go index 9414834d..af8feb92 100644 --- a/pkg/server/database/models.go +++ b/pkg/server/database/models.go @@ -115,7 +115,7 @@ type Notification struct { type EmailPreference struct { Model UserID int `gorm:"index" json:"-"` - InactiveReminder bool `json:"inactive_reminder" gorm:"default:true"` + InactiveReminder bool `json:"inactive_reminder" gorm:"default:false"` ProductUpdate bool `json:"product_update" gorm:"default:true"` } diff --git a/pkg/server/handlers/routes.go b/pkg/server/handlers/routes.go index c3a69961..ac1ff925 100644 --- a/pkg/server/handlers/routes.go +++ b/pkg/server/handlers/routes.go @@ -370,18 +370,18 @@ func (a *API) NewRouter() (*mux.Router, error) { {"PATCH", "/classic/set-password", a.auth(a.classicSetPassword, nil), true}, // v3 - {"GET", "/v3/sync/fragment", cors(a.auth(a.GetSyncFragment, nil)), false}, - {"GET", "/v3/sync/state", cors(a.auth(a.GetSyncState, nil)), false}, + {"GET", "/v3/sync/fragment", cors(a.auth(a.GetSyncFragment, &proOnly)), false}, + {"GET", "/v3/sync/state", cors(a.auth(a.GetSyncState, &proOnly)), false}, {"OPTIONS", "/v3/books", cors(a.BooksOptions), true}, - {"GET", "/v3/books", cors(a.auth(a.GetBooks, nil)), true}, - {"GET", "/v3/books/{bookUUID}", cors(a.auth(a.GetBook, nil)), true}, - {"POST", "/v3/books", cors(a.auth(a.CreateBook, nil)), false}, - {"PATCH", "/v3/books/{bookUUID}", cors(a.auth(a.UpdateBook, nil)), false}, - {"DELETE", "/v3/books/{bookUUID}", cors(a.auth(a.DeleteBook, nil)), false}, + {"GET", "/v3/books", cors(a.auth(a.GetBooks, &proOnly)), true}, + {"GET", "/v3/books/{bookUUID}", cors(a.auth(a.GetBook, &proOnly)), true}, + {"POST", "/v3/books", cors(a.auth(a.CreateBook, &proOnly)), false}, + {"PATCH", "/v3/books/{bookUUID}", cors(a.auth(a.UpdateBook, &proOnly)), false}, + {"DELETE", "/v3/books/{bookUUID}", cors(a.auth(a.DeleteBook, &proOnly)), false}, {"OPTIONS", "/v3/notes", cors(a.NotesOptions), true}, - {"POST", "/v3/notes", cors(a.auth(a.CreateNote, nil)), false}, - {"PATCH", "/v3/notes/{noteUUID}", a.auth(a.UpdateNote, nil), false}, - {"DELETE", "/v3/notes/{noteUUID}", a.auth(a.DeleteNote, nil), false}, + {"POST", "/v3/notes", cors(a.auth(a.CreateNote, &proOnly)), false}, + {"PATCH", "/v3/notes/{noteUUID}", a.auth(a.UpdateNote, &proOnly), false}, + {"DELETE", "/v3/notes/{noteUUID}", a.auth(a.DeleteNote, &proOnly), false}, {"POST", "/v3/signin", cors(a.signin), true}, {"OPTIONS", "/v3/signout", cors(a.signoutOptions), true}, {"POST", "/v3/signout", cors(a.signout), true}, diff --git a/pkg/server/handlers/subscription.go b/pkg/server/handlers/subscription.go index c28b3431..354fb1a1 100644 --- a/pkg/server/handlers/subscription.go +++ b/pkg/server/handlers/subscription.go @@ -41,7 +41,7 @@ import ( "github.com/stripe/stripe-go/webhook" ) -var proPlanID = "plan_EpgsEvY27pajfo" +var proPlanID = "plus" func getOrCreateStripeCustomer(tx *gorm.DB, user database.User) (*stripe.Customer, error) { if user.StripeCustomerID != "" { diff --git a/pkg/server/mailer/templates/src/subscription_confirmation.txt b/pkg/server/mailer/templates/src/subscription_confirmation.txt index 63cb440c..03e98a66 100644 --- a/pkg/server/mailer/templates/src/subscription_confirmation.txt +++ b/pkg/server/mailer/templates/src/subscription_confirmation.txt @@ -1,10 +1,12 @@ Hi, thanks for signing up for Dnote Pro. -Dnote Pro is your own simple personal knowledge base that helps you retain new information. +Now you can take your notes with you wherever you go! + +* Synchronize data among an unlimited number of machines. +* Access notes anywhere via the web interface. Your account is "{{ .AccountEmail }}". Log in at {{ .WebURL }}/login -I appreciate your support. It makes it possible to develop Dnote and help learners around the world. -Thank you for using my software. +Thank you for using Dnote. Your support makes it possible to develop it for developers around the world. - Sung (Maker of Dnote) diff --git a/pkg/server/mailer/templates/src/welcome.txt b/pkg/server/mailer/templates/src/welcome.txt index c7e60b59..daba304a 100644 --- a/pkg/server/mailer/templates/src/welcome.txt +++ b/pkg/server/mailer/templates/src/welcome.txt @@ -1,6 +1,6 @@ Hi, welcome to Dnote. -Dnote is a simple personal knowledge base just for you. It helps you quickly capture new information and retain them. +Dnote is a simple command-line notebook. YOUR ACCOUNT @@ -11,6 +11,6 @@ SOURCE CODE Dnote is open source and you can see the source code at https://github.com/dnote/dnote -Feel free to reply anytime. Thanks for using my software. +Feel free to reply anytime. Thanks for using Dnote. - Sung (Maker of Dnote) diff --git a/web/src/components/App/_buttons.scss b/web/src/components/App/_buttons.scss index e2a61ea2..6178c0ce 100644 --- a/web/src/components/App/_buttons.scss +++ b/web/src/components/App/_buttons.scss @@ -54,13 +54,11 @@ vertical-align: middle; user-select: none; border-image: initial; - border-radius: 0.25rem; transition-property: color, box-shadow; transition-duration: 0.2s; transition-timing-function: ease-in-out; text-decoration: none; - border-radius: 5px; cursor: pointer; &:not(.button-no-ui) { @@ -94,7 +92,7 @@ button:disabled { } .button-normal { - @include font-size('small'); + // @include font-size('small'); padding: rem(8px) rem(16px); } diff --git a/web/src/components/Books/index.tsx b/web/src/components/Books/index.tsx index a9ef8925..25b9326e 100644 --- a/web/src/components/Books/index.tsx +++ b/web/src/components/Books/index.tsx @@ -20,6 +20,7 @@ import React, { useEffect, useState, Fragment } from 'react'; import { getBooks } from '../../store/books'; import { useDispatch } from '../../store'; +import PayWall from '../Common/PayWall'; import Content from './Content'; import Flash from '../Common/Flash'; import HeadData from './HeadData'; @@ -36,20 +37,22 @@ const Books: React.FunctionComponent = () => { -
-
- { - setSuccessMessage(''); - }} - > - {successMessage} - + +
+
+ { + setSuccessMessage(''); + }} + > + {successMessage} + +
+ ;
- ; -
+ ); }; diff --git a/web/src/components/Common/PayWall.tsx b/web/src/components/Common/PayWall.tsx index 35ffcfeb..1d52f33f 100644 --- a/web/src/components/Common/PayWall.tsx +++ b/web/src/components/Common/PayWall.tsx @@ -48,7 +48,7 @@ const PayWall: React.FunctionComponent = ({
-

Unlock Dnote Pro to get started.

+

Please unlock Dnote Cloud to use.

= ({ > Get started - {/* - - Live demo - - */}
); diff --git a/web/src/components/Digests/index.tsx b/web/src/components/Digests/index.tsx index 001e040d..5487f46a 100644 --- a/web/src/components/Digests/index.tsx +++ b/web/src/components/Digests/index.tsx @@ -17,11 +17,10 @@ */ import React, { useEffect } from 'react'; -import { Link, RouteComponentProps } from 'react-router-dom'; +import { RouteComponentProps } from 'react-router-dom'; import Helmet from 'react-helmet'; import { usePrevious } from 'web/libs/hooks'; -import { getSubscriptionPath } from 'web/libs/paths'; import { parseSearchString } from 'jslib/helpers/url'; import { useDispatch, useSelector } from '../../store'; import { getDigests } from '../../store/digests'; @@ -50,7 +49,7 @@ function useFetchDigests(params: { page: number; status: Status }) { interface Props extends RouteComponentProps {} const Digests: React.FunctionComponent = ({ location }) => { - const { user, digests } = useSelector(state => { + const { digests } = useSelector(state => { return { digests: state.digests, user: state.auth.user.data @@ -83,9 +82,9 @@ const Digests: React.FunctionComponent = ({ location }) => { Error getting digests: {digests.errorMessage} - - Digests are not enabled on your plan.{' '} - Upgrade here. + + Spaced repetition is deprecated and will be removed in the next major + release.
diff --git a/web/src/components/Header/Nav/index.tsx b/web/src/components/Header/Nav/index.tsx index b991e3c1..76c2a740 100644 --- a/web/src/components/Header/Nav/index.tsx +++ b/web/src/components/Header/Nav/index.tsx @@ -19,12 +19,7 @@ import React from 'react'; import classnames from 'classnames'; -import { - getNewPath, - getBooksPath, - getRepetitionsPath, - getDigestsPath -} from 'web/libs/paths'; +import { getNewPath, getBooksPath } from 'web/libs/paths'; import { Filters, toSearchObj } from 'jslib/helpers/filters'; import Item from './Item'; import styles from './Nav.scss'; @@ -41,8 +36,6 @@ const Nav: React.FunctionComponent = ({ filters }) => {
    - -
); diff --git a/web/src/components/Header/SearchBar/AdvancedPanel/BookSearch.tsx b/web/src/components/Header/SearchBar/AdvancedPanel/BookSearch.tsx index 7bc83ca2..54137007 100644 --- a/web/src/components/Header/SearchBar/AdvancedPanel/BookSearch.tsx +++ b/web/src/components/Header/SearchBar/AdvancedPanel/BookSearch.tsx @@ -29,6 +29,7 @@ import styles from './AdvancedPanel.scss'; interface Props { value: string; setValue: (string) => void; + disabled: boolean; } // getCurrentTerm returns the current term in the comma separated @@ -112,7 +113,11 @@ function useSetSuggestionVisibility( }, [setIsOpen, triggerRef, inputValue, prevInputValue]); } -const BookSearch: React.FunctionComponent = ({ value, setValue }) => { +const BookSearch: React.FunctionComponent = ({ + value, + setValue, + disabled +}) => { const [isOpen, setIsOpen] = useState(false); const [focusedIdx, setFocusedIdx] = useState(0); const [focusedOptEl, setFocusedOptEl] = useState(null); @@ -136,7 +141,7 @@ const BookSearch: React.FunctionComponent = ({ value, setValue }) => { focusedIdx, setFocusedIdx, onKeydownSelect: appendBook, - disabled: !isOpen + disabled: !isOpen || disabled }); useScrollToFocused({ shouldScroll: true, @@ -162,6 +167,7 @@ const BookSearch: React.FunctionComponent = ({ value, setValue }) => { styles.input )} value={value} + disabled={disabled} onChange={e => { const val = e.target.value; diff --git a/web/src/components/Header/SearchBar/AdvancedPanel/WordsSearch.tsx b/web/src/components/Header/SearchBar/AdvancedPanel/WordsSearch.tsx index 2ff66f9d..a940edbf 100644 --- a/web/src/components/Header/SearchBar/AdvancedPanel/WordsSearch.tsx +++ b/web/src/components/Header/SearchBar/AdvancedPanel/WordsSearch.tsx @@ -24,9 +24,14 @@ import styles from './AdvancedPanel.scss'; interface Props { words: string; setWords: (string) => void; + disabled: boolean; } -const WordsSearch: React.FunctionComponent = ({ words, setWords }) => { +const WordsSearch: React.FunctionComponent = ({ + words, + setWords, + disabled +}) => { return (