From 7f34a455e23d8e385b4ca413d2e20fa33e957539 Mon Sep 17 00:00:00 2001 From: Daniel O'Connell Date: Thu, 15 Feb 2024 16:09:15 +0100 Subject: [PATCH 1/3] Deploy test env --- .github/workflows/deploy-dev.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/deploy-dev.yml diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml new file mode 100644 index 00000000..dd4a69d5 --- /dev/null +++ b/.github/workflows/deploy-dev.yml @@ -0,0 +1,32 @@ +name: Deploy to dev Cloudflare Worker +on: + workflow_dispatch: + pull_request: + branches: + - stampy-redesign + types: + - closed +env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} +jobs: + deploy: + if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: Clone stampy-ui repository code + uses: actions/checkout@v3 + - name: Deploy to Cloudflare + run: | + cat wrangler.toml.template \ + | sed s/stampy-ui/redesign/ \ + | sed s/{CLOUDFLARE_ACCT_ID}/${{ secrets.CLOUDFLARE_ACCT_ID }}/ \ + | sed s/{STAMPY_KV_ID}/${{ secrets.STAMPY_KV_ID }}/ \ + | sed s/{CODA_TOKEN}/${{ secrets.CODA_TOKEN }}/ \ + | sed s/{CODA_INCOMING_TOKEN}/${{ secrets.CODA_INCOMING_TOKEN }}/ \ + | sed s/{CODA_WRITES_TOKEN}/${{ secrets.CODA_WRITES_TOKEN }}/ \ + | sed s/{GOOGLE_ANALYTICS_ID}/${{ secrets.GOOGLE_ANALYTICS_ID }}/ \ + > wrangler.toml + npm ci + npm run deploy + - name: 'Debug: list files in build directory' + run: ls -R build public/build From 41be27beaf4dfce0184f77e469fb190d44c75942 Mon Sep 17 00:00:00 2001 From: Daniel O'Connell Date: Thu, 15 Feb 2024 17:34:42 +0100 Subject: [PATCH 2/3] change cloudflare account for tests --- .github/workflows/deploy-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index dd4a69d5..2176478d 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -19,8 +19,8 @@ jobs: run: | cat wrangler.toml.template \ | sed s/stampy-ui/redesign/ \ - | sed s/{CLOUDFLARE_ACCT_ID}/${{ secrets.CLOUDFLARE_ACCT_ID }}/ \ - | sed s/{STAMPY_KV_ID}/${{ secrets.STAMPY_KV_ID }}/ \ + | sed s/{CLOUDFLARE_ACCT_ID}/${{ secrets.CLOUDFLARE_ACCT_ID_APRILLION_WORKERS_DEV }}/ \ + | sed s/{STAMPY_KV_ID}/${{ secrets.STAMPY_KV_ID_APRILLION_WORKERS_DEV }}/ \ | sed s/{CODA_TOKEN}/${{ secrets.CODA_TOKEN }}/ \ | sed s/{CODA_INCOMING_TOKEN}/${{ secrets.CODA_INCOMING_TOKEN }}/ \ | sed s/{CODA_WRITES_TOKEN}/${{ secrets.CODA_WRITES_TOKEN }}/ \ From 8bb80761367f180b7214ac95fe83f1b5f21d43cf Mon Sep 17 00:00:00 2001 From: Daniel O'Connell Date: Fri, 8 Mar 2024 18:22:39 +0100 Subject: [PATCH 3/3] lots of little fixes --- app/components/Article/FeedbackForm/index.tsx | 3 +-- app/components/Article/KeepGoing/index.tsx | 2 +- app/components/ArticlesDropdown/dropdown.css | 6 ++++++ app/components/Button/button.css | 2 +- app/components/Footer/index.tsx | 2 +- app/components/Nav/Mobile/index.tsx | 21 +++++++------------ app/components/Nav/Mobile/navMobile.css | 3 --- app/components/Nav/index.tsx | 7 ------- app/routes/_index.tsx | 4 +--- app/routes/questions.toc.ts | 7 ++++++- remix.config.js | 1 - 11 files changed, 24 insertions(+), 34 deletions(-) diff --git a/app/components/Article/FeedbackForm/index.tsx b/app/components/Article/FeedbackForm/index.tsx index 1434a8d4..81199374 100644 --- a/app/components/Article/FeedbackForm/index.tsx +++ b/app/components/Article/FeedbackForm/index.tsx @@ -32,7 +32,6 @@ const FeedbackForm = ({ hasOptions = true, }: FeedbackFormProps) => { // to be implemented. - console.log(pageid) const [selected, setSelected] = React.useState() const options = [ { @@ -77,7 +76,7 @@ const FeedbackForm = ({ const handleSubmit = () => {} return ( -
+
What was the problem? {hasOptions diff --git a/app/components/Article/KeepGoing/index.tsx b/app/components/Article/KeepGoing/index.tsx index dc276e94..8a431d47 100644 --- a/app/components/Article/KeepGoing/index.tsx +++ b/app/components/Article/KeepGoing/index.tsx @@ -17,7 +17,7 @@ type NextArticleProps = { const NextArticle = ({section, next, first}: NextArticleProps) => next && ( <> -

Keep reading! 👉

+

Keep reading!

{first ? 'Start' : 'Continue'} with the {first ? 'first' : 'next'} entry in " {section?.title}" diff --git a/app/components/ArticlesDropdown/dropdown.css b/app/components/ArticlesDropdown/dropdown.css index ab6f2944..f28fd3be 100644 --- a/app/components/ArticlesDropdown/dropdown.css +++ b/app/components/ArticlesDropdown/dropdown.css @@ -28,3 +28,9 @@ .articles-dropdown-container .toc { border-right: 1px solid var(--colors-cool-grey-200); } + +@media (max-width: 640px) { + .articles-dropdown-container .toc { + border-right: 0; + } +} diff --git a/app/components/Button/button.css b/app/components/Button/button.css index 3025eaba..9625c09f 100644 --- a/app/components/Button/button.css +++ b/app/components/Button/button.css @@ -98,7 +98,7 @@ content: attr(data-tooltip); position: absolute; transform: translateY(var(--spacing-56, 56px)); - padding: var(--spacing-4); + padding: var(--spacing-16); color: var(--colors-white); background: var(--colors-black); border-radius: 5px; diff --git a/app/components/Footer/index.tsx b/app/components/Footer/index.tsx index 2a0d389d..e5cc4911 100644 --- a/app/components/Footer/index.tsx +++ b/app/components/Footer/index.tsx @@ -35,7 +35,7 @@ export const FooterBar: FunctionComponent = () => {

Partner projects

- +
diff --git a/app/components/Nav/Mobile/index.tsx b/app/components/Nav/Mobile/index.tsx index 121249d9..08fe592d 100644 --- a/app/components/Nav/Mobile/index.tsx +++ b/app/components/Nav/Mobile/index.tsx @@ -5,7 +5,6 @@ import {ListLarge} from '~/components/icons-generated' import {XLarge} from '~/components/icons-generated' import {CarrotLarge} from '~/components/icons-generated' import OpenBookIcon from '~/components/icons-generated/OpenBook' -import BotIcon from '~/components/icons-generated/Bot' import MagnifyingLarge from '~/components/icons-generated/MagnifyingLarge' import {NavProps} from '~/components/Nav' import Button from '~/components/Button' @@ -38,18 +37,18 @@ export const MobileNav = ({toc, categories}: NavProps) => { {!showMenu ? (
- - setShowMenu(true)} /> + + setShowMenu(true)} />
) : ( - + )} )} {showSearch ? (
- +
) : null} @@ -62,16 +61,10 @@ export const MobileNav = ({toc, categories}: NavProps) => { >

- Articles + Articles

-
)} @@ -84,10 +77,10 @@ export const MobileNav = ({toc, categories}: NavProps) => { Articles

- + -
+
diff --git a/app/components/Nav/Mobile/navMobile.css b/app/components/Nav/Mobile/navMobile.css index ee42cc64..de0735c6 100644 --- a/app/components/Nav/Mobile/navMobile.css +++ b/app/components/Nav/Mobile/navMobile.css @@ -9,9 +9,6 @@ .top-logo { padding: 0; } - .menu-button { - cursor: pointer; - } .composite-elements { display: flex; align-items: center; diff --git a/app/components/Nav/index.tsx b/app/components/Nav/index.tsx index 364d9cb7..0d9bab72 100644 --- a/app/components/Nav/index.tsx +++ b/app/components/Nav/index.tsx @@ -1,7 +1,6 @@ import {Link} from '@remix-run/react' import {MenuItem} from '~/components/Menu' import OpenBookIcon from '~/components/icons-generated/OpenBook' -import BotIcon from '~/components/icons-generated/Bot' import AISafetyIcon from '~/components/icons-generated/Aisafety' import ArticlesDropdown from '~/components/ArticlesDropdown' import type {TOCItem} from '~/routes/questions.toc' @@ -29,12 +28,6 @@ export const Nav = ({toc, categories}: NavProps) => { id="showArticles" /> - } - text="Stampy chatbot" - />
  • diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 561dd47e..a43172df 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,7 +1,6 @@ import type {LoaderFunction} from '@remix-run/cloudflare' import {ShouldRevalidateFunction, redirect} from '@remix-run/react' import {QuestionState} from '~/server-utils/stampy' -import {WidgetStampy} from '~/components/Widget/Stampy' import {ContentBoxMain, ContentBoxSecond, ContentBoxThird} from '~/components/ContentBox' import useToC from '~/hooks/useToC' import Grid from '~/components/Grid' @@ -29,7 +28,6 @@ export const shouldRevalidate: ShouldRevalidateFunction = () => false export default function App() { const {advanced} = useToC() - console.log(advanced) return (
    @@ -40,7 +38,7 @@ export default function App() {
    - + {/* */}

    Advanced sections

    diff --git a/app/routes/questions.toc.ts b/app/routes/questions.toc.ts index 816f519f..bf10cbc7 100644 --- a/app/routes/questions.toc.ts +++ b/app/routes/questions.toc.ts @@ -1,6 +1,6 @@ import type {LoaderFunction} from '@remix-run/cloudflare' import {reloadInBackgroundIfNeeded} from '~/server-utils/kv-cache' -import {loadAllQuestions, Question, PageId} from '~/server-utils/stampy' +import {loadAllQuestions, Question, PageId, QuestionStatus} from '~/server-utils/stampy' const MAX_LEVELS = 3 export const INTRODUCTORY = 'Introductory' @@ -59,7 +59,11 @@ export const loadToC = async (request: any): Promise => { const items = data.reduce((acc, item) => ({...acc, [item.title]: item}), {}) as { [k: string]: Question } + const canBeShown = ({status}: Question) => + status && [QuestionStatus.LIVE_ON_SITE, QuestionStatus.NOT_STARTED].includes(status) + data + .filter(canBeShown) .filter(({parents}) => parents && parents.length > 0) .forEach((item) => { item?.parents?.forEach((name) => { @@ -72,6 +76,7 @@ export const loadToC = async (request: any): Promise => { }) return { data: data + .filter(canBeShown) .filter(({tags}) => tags.includes(INTRODUCTORY) || tags.includes(ADVANCED)) .map(formatQuestion(1)) .sort((a, b) => (a.order || 0) - (b.order || 0)), diff --git a/remix.config.js b/remix.config.js index c6d3fca3..bb1ec3f0 100644 --- a/remix.config.js +++ b/remix.config.js @@ -1,6 +1,5 @@ const routes = (defineRoutes) => defineRoutes((route) => { - console.log(route) route('/*', 'routes/$redirects.tsx') })