From 8761a46767f224c2fa0af3adc2d78118b9c4263a Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 6 Feb 2018 20:54:49 -0800 Subject: [PATCH] implement search --- bin/svgs.js | 1 + routes/_components/LoadingPage.html | 24 +++++ routes/_components/Nav.html | 3 + .../search/AccountSearchResult.html | 49 ++++++++++ .../search/HashtagSearchResult.html | 13 +++ routes/_components/search/Search.html | 93 +++++++++++++++++++ routes/_components/search/SearchResult.html | 28 ++++++ routes/_components/search/SearchResults.html | 34 +++++++ .../search/StatusSearchResult.html | 18 ++++ routes/_components/status/Avatar.html | 6 +- routes/_components/status/Status.html | 15 ++- routes/_components/timeline/Timeline.html | 19 +--- routes/_store/store.js | 1 + routes/_utils/mastodon/search.js | 12 +++ routes/search.html | 48 ++++++++++ scss/global.scss | 5 + templates/2xx.html | 3 +- 17 files changed, 349 insertions(+), 23 deletions(-) create mode 100644 routes/_components/LoadingPage.html create mode 100644 routes/_components/search/AccountSearchResult.html create mode 100644 routes/_components/search/HashtagSearchResult.html create mode 100644 routes/_components/search/Search.html create mode 100644 routes/_components/search/SearchResult.html create mode 100644 routes/_components/search/SearchResults.html create mode 100644 routes/_components/search/StatusSearchResult.html create mode 100644 routes/_utils/mastodon/search.js create mode 100644 routes/search.html diff --git a/bin/svgs.js b/bin/svgs.js index c3df6eda..8952ad41 100644 --- a/bin/svgs.js +++ b/bin/svgs.js @@ -18,4 +18,5 @@ module.exports = [ {id:'fa-user-times', src:'node_modules/font-awesome-svg-png/white/svg/user-times.svg', title: 'Stop Following'}, {id:'fa-user-plus', src:'node_modules/font-awesome-svg-png/white/svg/user-plus.svg', title: 'Follow'}, {id:'fa-external-link', src:'node_modules/font-awesome-svg-png/white/svg/external-link.svg', title: 'External Link'}, + {id:'fa-search', src:'node_modules/font-awesome-svg-png/white/svg/search.svg', title: 'Search'}, ] \ No newline at end of file diff --git a/routes/_components/LoadingPage.html b/routes/_components/LoadingPage.html new file mode 100644 index 00000000..0314c649 --- /dev/null +++ b/routes/_components/LoadingPage.html @@ -0,0 +1,24 @@ +
+ +
+ + \ No newline at end of file diff --git a/routes/_components/Nav.html b/routes/_components/Nav.html index a0a4e3ae..0d81a53f 100644 --- a/routes/_components/Nav.html +++ b/routes/_components/Nav.html @@ -12,6 +12,9 @@
  • +
  • + +
  • diff --git a/routes/_components/search/AccountSearchResult.html b/routes/_components/search/AccountSearchResult.html new file mode 100644 index 00000000..e0f0c5b4 --- /dev/null +++ b/routes/_components/search/AccountSearchResult.html @@ -0,0 +1,49 @@ + + + + + \ No newline at end of file diff --git a/routes/_components/search/HashtagSearchResult.html b/routes/_components/search/HashtagSearchResult.html new file mode 100644 index 00000000..881f1c3d --- /dev/null +++ b/routes/_components/search/HashtagSearchResult.html @@ -0,0 +1,13 @@ + + {{'#' + hashtag}} + + + \ No newline at end of file diff --git a/routes/_components/search/Search.html b/routes/_components/search/Search.html new file mode 100644 index 00000000..7240f6ec --- /dev/null +++ b/routes/_components/search/Search.html @@ -0,0 +1,93 @@ +
    +
    + +
    + +
    +{{#if loading}} +
    + +
    +{{elseif $searchResults && $searchResultsForQuery === $queryInSearch}} +
    + +
    +{{/if}} + + \ No newline at end of file diff --git a/routes/_components/search/SearchResult.html b/routes/_components/search/SearchResult.html new file mode 100644 index 00000000..1e7d30a7 --- /dev/null +++ b/routes/_components/search/SearchResult.html @@ -0,0 +1,28 @@ +
  • + + + +
  • + \ No newline at end of file diff --git a/routes/_components/search/SearchResults.html b/routes/_components/search/SearchResults.html new file mode 100644 index 00000000..362eab72 --- /dev/null +++ b/routes/_components/search/SearchResults.html @@ -0,0 +1,34 @@ + + + \ No newline at end of file diff --git a/routes/_components/search/StatusSearchResult.html b/routes/_components/search/StatusSearchResult.html new file mode 100644 index 00000000..f3f16100 --- /dev/null +++ b/routes/_components/search/StatusSearchResult.html @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/routes/_components/status/Avatar.html b/routes/_components/status/Avatar.html index b531120b..6be1c640 100644 --- a/routes/_components/status/Avatar.html +++ b/routes/_components/status/Avatar.html @@ -1,12 +1,12 @@ {{#if error}} - {{else}} - {{/if}} \ No newline at end of file diff --git a/scss/global.scss b/scss/global.scss index 74d1ef58..58a437a5 100644 --- a/scss/global.scss +++ b/scss/global.scss @@ -129,3 +129,8 @@ button::-moz-focus-inner { border: 0; } +/* Firefox hacks to remove ugly red border. + Unnecessary since it gives a warning if you submit an empty field anyway. */ +input:required, input:invalid { + box-shadow: none; +} \ No newline at end of file diff --git a/templates/2xx.html b/templates/2xx.html index b248cfd7..80c8ae55 100644 --- a/templates/2xx.html +++ b/templates/2xx.html @@ -11,7 +11,7 @@ @@ -83,6 +83,7 @@ body.offline,body.theme-hotpants.offline,body.theme-majesty.offline,body.theme-o Stop Following Follow External Link +Search