diff --git a/.github/workflows/build_test_and_check.yml b/.github/workflows/build_test_and_check.yml index d1422f93..1fc0fff6 100644 --- a/.github/workflows/build_test_and_check.yml +++ b/.github/workflows/build_test_and_check.yml @@ -32,41 +32,24 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Build binary - uses: actions-rs/cargo@v1 - with: - command: build - args: --verbose + - uses: actions/checkout@v4 + - name: Build binary + run: cargo build --verbose test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace --verbose + - uses: actions/checkout@v4 + - name: Run tests + run: cargo test --workspace --verbose lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Run linting - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all --all-targets --all-features -- -D warnings + - uses: actions/checkout@v4 + - name: Run linting + run: cargo clippy --all --all-targets --all-features -- -D warnings format_check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: rustfmt - override: true + - uses: actions/checkout@v4 - name: Run format - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml deleted file mode 100644 index 09c3fb4f..00000000 --- a/.github/workflows/docker_build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: build-docker-image - -on: - push: - branches: - - 'release/**' - pull_request: - paths: - - 'Dockerfile' - workflow_dispatch: - -jobs: - build_docker_image: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build - id: docker_build - uses: docker/build-push-action@v3 - with: - push: false - tags: openbookpublishers/thoth:latest - build-args: | - THOTH_GRAPHQL_API=https://api.thoth.pub - THOTH_EXPORT_API=https://export.thoth.pub - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/docker_build_and_push_to_dockerhub.yml b/.github/workflows/docker_build_and_push_to_dockerhub.yml index 382d043c..e63dcb78 100644 --- a/.github/workflows/docker_build_and_push_to_dockerhub.yml +++ b/.github/workflows/docker_build_and_push_to_dockerhub.yml @@ -1,15 +1,15 @@ name: publish-to-dockerhub on: - release: - types: [published] + pull_request: + workflow_dispatch: jobs: - build_and_push_docker_image: + build_and_push_staging_docker_image: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Docker meta id: meta uses: docker/metadata-action@v4 @@ -19,21 +19,19 @@ jobs: openbookpublishers/thoth # generate Docker tags based on the following events/attributes tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} + type=ref,event=pr,prefix=staging-pr- - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push id: docker_build - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: push: true tags: ${{ steps.meta.outputs.tags }} @@ -43,3 +41,23 @@ jobs: THOTH_EXPORT_API=https://export.thoth.pub - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} + + build_dev_docker_image: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build + id: docker_build + uses: docker/build-push-action@v5 + with: + push: false + tags: openbookpublishers/thoth:latest + file: Dockerfile.dev + build-args: | + THOTH_GRAPHQL_API=https://api.thoth.pub + THOTH_EXPORT_API=https://export.thoth.pub + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/docker_build_and_push_to_dockerhub_release.yml b/.github/workflows/docker_build_and_push_to_dockerhub_release.yml new file mode 100644 index 00000000..7ea8f4e9 --- /dev/null +++ b/.github/workflows/docker_build_and_push_to_dockerhub_release.yml @@ -0,0 +1,45 @@ +name: publish-to-dockerhub + +on: + release: + types: [published] + +jobs: + build_and_push_docker_image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + openbookpublishers/thoth + # generate Docker tags based on the following events/attributes + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v5 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + THOTH_GRAPHQL_API=https://api.thoth.pub + THOTH_EXPORT_API=https://export.thoth.pub + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/docker_build_dev.yml b/.github/workflows/docker_build_dev.yml deleted file mode 100644 index f1cbc978..00000000 --- a/.github/workflows/docker_build_dev.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: build-dev-docker-image - -on: - push: - branches: - - master - - develop - paths: - - 'Dockerfile.dev' - pull_request: - paths: - - 'Dockerfile.dev' - workflow_dispatch: - -jobs: - build_dev_docker_image: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Build - id: docker_build - uses: docker/build-push-action@v3 - with: - push: false - tags: openbookpublishers/thoth:latest - file: Dockerfile.dev - build-args: | - THOTH_GRAPHQL_API=https://api.thoth.pub - THOTH_EXPORT_API=https://export.thoth.pub - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/docker_build_dev_no_action.yml b/.github/workflows/docker_build_dev_no_action.yml deleted file mode 100644 index 0a621a0b..00000000 --- a/.github/workflows/docker_build_dev_no_action.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: build-dev-docker-image - -on: - push: - branches: - - master - - develop - paths-ignore: - - 'Dockerfile.dev' - pull_request: - paths-ignore: - - 'Dockerfile.dev' - -jobs: - build_dev_docker_image: - runs-on: ubuntu-latest - steps: - - run: 'echo "No build required"' diff --git a/.github/workflows/docker_build_no_action.yml b/.github/workflows/docker_build_no_action.yml deleted file mode 100644 index b51e4de8..00000000 --- a/.github/workflows/docker_build_no_action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: build-docker-image - -on: - pull_request: - paths-ignore: - - 'Dockerfile' - -jobs: - build_docker_image: - runs-on: ubuntu-latest - steps: - - run: 'echo "No build required"' diff --git a/.github/workflows/run_migrations.yml b/.github/workflows/run_migrations.yml index fa3d8808..8bb9f52b 100644 --- a/.github/workflows/run_migrations.yml +++ b/.github/workflows/run_migrations.yml @@ -40,19 +40,10 @@ jobs: ports: - 5432:5432 steps: - - uses: actions/checkout@v3 - - name: Build binary - uses: actions-rs/cargo@v1 - with: - command: build - args: --verbose - - name: Run migrations - uses: actions-rs/cargo@v1 - with: - command: run - args: migrate - - name: Revert migrations - uses: actions-rs/cargo@v1 - with: - command: run - args: migrate --revert + - uses: actions/checkout@v4 + - name: Build binary + run: cargo build --verbose + - name: Run migrations + run: cargo run migrate + - name: Revert migrations + run: cargo run migrate --revert diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b92da7e..9eb789aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Removed + - [549](https://github.com/thoth-pub/thoth/pull/549) - Deprecate public-facing pages in Thoth APP in favour of a separate, standalone, website + +### Added + - [549](https://github.com/thoth-pub/thoth/pull/549) - Build and push staging docker images on pull requests + +### Changed + - [549](https://github.com/thoth-pub/thoth/pull/549) - Upgrade GitHub actions dependencies (`docker/setup-qemu-action@v3`, `docker/setup-buildx-action@v3`, `docker/login-action@v3`, `docker/build-push-action@v5`, `actions/checkout@v4`, `actions/setup-node@v4`) ## [[0.11.18]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.18) - 2024-03-07 ### Added diff --git a/thoth-app-server/src/lib.rs b/thoth-app-server/src/lib.rs index bcc752af..56165713 100644 --- a/thoth-app-server/src/lib.rs +++ b/thoth-app-server/src/lib.rs @@ -26,40 +26,38 @@ macro_rules! static_files { } static_files! { - (JS, js_file) => ("../static/pkg/thoth-app.js", "/thoth-app.js", "application/javascript"), - (WASM, wasm_file) => ("../static/pkg/thoth-app_bg.wasm", "/thoth-app_bg.wasm", "application/wasm"), - (BULMA, bulma_file) => ("../static/pkg/bulma-pageloader.min.css", "/bulma-pageloader.min.css", "text/css; charset=utf-8"), - (CSS, css_file) => ("../static/pkg/thoth.css", "/thoth.css", "text/css; charset=utf-8"), - (LOGO, logo_file) => ("../static/img/thoth-logo.png", "/img/thoth-logo.png", "image/png"), - (BANNER, banner_file) => ("../static/img/thoth-banner.png", "/img/thoth-banner.png", "image/png"), - (COVER, cover_file) => ("../static/img/cover-placeholder.jpg", "/img/cover-placeholder.jpg", "image/jpg"), - (XML, xml_file) => ("../static/browserconfig.xml", "/browserconfig.xml", "application/xml"), - (JSON, json_file) => ("../static/manifest.json", "/manifest.json", "application/json"), - (ICON, icon_file) => ("../static/img/favicon.ico", "/favicon.ico", "image/x-icon"), - (ICON1, icon_file1) => ("../static/img/android-icon-144x144.png", "/android-icon-144x144.png", "image/png"), - (ICON2, icon_file2) => ("../static/img/android-icon-192x192.png", "/android-icon-192x192.png", "image/png"), - (ICON3, icon_file3) => ("../static/img/android-icon-36x36.png", "/android-icon-36x36.png", "image/png"), - (ICON4, icon_file4) => ("../static/img/android-icon-48x48.png", "/android-icon-48x48.png", "image/png"), - (ICON5, icon_file5) => ("../static/img/android-icon-72x72.png", "/android-icon-72x72.png", "image/png"), - (ICON6, icon_file6) => ("../static/img/android-icon-96x96.png", "/android-icon-96x96.png", "image/png"), - (ICON7, icon_file7) => ("../static/img/apple-icon-114x114.png", "/apple-icon-114x114.png", "image/png"), - (ICON8, icon_file8) => ("../static/img/apple-icon-120x120.png", "/apple-icon-120x120.png", "image/png"), - (ICON9, icon_file9) => ("../static/img/apple-icon-144x144.png", "/apple-icon-144x144.png", "image/png"), - (ICON10, icon_file10) => ("../static/img/apple-icon-152x152.png", "/apple-icon-152x152.png", "image/png"), - (ICON11, icon_file11) => ("../static/img/apple-icon-180x180.png", "/apple-icon-180x180.png", "image/png"), - (ICON12, icon_file12) => ("../static/img/apple-icon-57x57.png", "/apple-icon-57x57.png", "image/png"), - (ICON13, icon_file13) => ("../static/img/apple-icon-60x60.png", "/apple-icon-60x60.png", "image/png"), - (ICON14, icon_file14) => ("../static/img/apple-icon-72x72.png", "/apple-icon-72x72.png", "image/png"), - (ICON15, icon_file15) => ("../static/img/apple-icon-76x76.png", "/apple-icon-76x76.png", "image/png"), - (ICON16, icon_file16) => ("../static/img/apple-icon-precomposed.png", "/apple-icon-precomposed.png", "image/png"), - (ICON17, icon_file17) => ("../static/img/apple-icon.png", "/apple-icon.png", "image/png"), - (ICON18, icon_file18) => ("../static/img/favicon-16x16.png", "/favicon-16x16.png", "image/png"), - (ICON19, icon_file19) => ("../static/img/favicon-32x32.png", "/favicon-32x32.png", "image/png"), - (ICON20, icon_file20) => ("../static/img/favicon-96x96.png", "/favicon-96x96.png", "image/png"), - (ICON21, icon_file21) => ("../static/img/ms-icon-144x144.png", "/ms-icon-144x144.png", "image/png"), - (ICON22, icon_file22) => ("../static/img/ms-icon-150x150.png", "/ms-icon-150x150.png", "image/png"), - (ICON23, icon_file23) => ("../static/img/ms-icon-310x310.png", "/ms-icon-310x310.png", "image/png"), - (ICON24, icon_file24) => ("../static/img/ms-icon-70x70.png", "/ms-icon-70x70.png", "image/png"), + (JS, js_file) => ("../static/pkg/thoth-app.js", "/admin/thoth-app.js", "application/javascript"), + (WASM, wasm_file) => ("../static/pkg/thoth-app_bg.wasm", "/admin/thoth-app_bg.wasm", "application/wasm"), + (BULMA, bulma_file) => ("../static/pkg/bulma-pageloader.min.css", "/admin/bulma-pageloader.min.css", "text/css; charset=utf-8"), + (CSS, css_file) => ("../static/pkg/thoth.css", "/admin/thoth.css", "text/css; charset=utf-8"), + (LOGO, logo_file) => ("../static/img/thoth-logo.png", "/admin/img/thoth-logo.png", "image/png"), + (XML, xml_file) => ("../static/browserconfig.xml", "/admin/browserconfig.xml", "application/xml"), + (JSON, json_file) => ("../static/manifest.json", "/admin/manifest.json", "application/json"), + (ICON, icon_file) => ("../static/img/favicon.ico", "/admin/favicon.ico", "image/x-icon"), + (ICON1, icon_file1) => ("../static/img/android-icon-144x144.png", "/admin/android-icon-144x144.png", "image/png"), + (ICON2, icon_file2) => ("../static/img/android-icon-192x192.png", "/admin/android-icon-192x192.png", "image/png"), + (ICON3, icon_file3) => ("../static/img/android-icon-36x36.png", "/admin/android-icon-36x36.png", "image/png"), + (ICON4, icon_file4) => ("../static/img/android-icon-48x48.png", "/admin/android-icon-48x48.png", "image/png"), + (ICON5, icon_file5) => ("../static/img/android-icon-72x72.png", "/admin/android-icon-72x72.png", "image/png"), + (ICON6, icon_file6) => ("../static/img/android-icon-96x96.png", "/admin/android-icon-96x96.png", "image/png"), + (ICON7, icon_file7) => ("../static/img/apple-icon-114x114.png", "/admin/apple-icon-114x114.png", "image/png"), + (ICON8, icon_file8) => ("../static/img/apple-icon-120x120.png", "/admin/apple-icon-120x120.png", "image/png"), + (ICON9, icon_file9) => ("../static/img/apple-icon-144x144.png", "/admin/apple-icon-144x144.png", "image/png"), + (ICON10, icon_file10) => ("../static/img/apple-icon-152x152.png", "/admin/apple-icon-152x152.png", "image/png"), + (ICON11, icon_file11) => ("../static/img/apple-icon-180x180.png", "/admin/apple-icon-180x180.png", "image/png"), + (ICON12, icon_file12) => ("../static/img/apple-icon-57x57.png", "/admin/apple-icon-57x57.png", "image/png"), + (ICON13, icon_file13) => ("../static/img/apple-icon-60x60.png", "/admin/apple-icon-60x60.png", "image/png"), + (ICON14, icon_file14) => ("../static/img/apple-icon-72x72.png", "/admin/apple-icon-72x72.png", "image/png"), + (ICON15, icon_file15) => ("../static/img/apple-icon-76x76.png", "/admin/apple-icon-76x76.png", "image/png"), + (ICON16, icon_file16) => ("../static/img/apple-icon-precomposed.png", "/admin/apple-icon-precomposed.png", "image/png"), + (ICON17, icon_file17) => ("../static/img/apple-icon.png", "/admin/apple-icon.png", "image/png"), + (ICON18, icon_file18) => ("../static/img/favicon-16x16.png", "/admin/favicon-16x16.png", "image/png"), + (ICON19, icon_file19) => ("../static/img/favicon-32x32.png", "/admin/favicon-32x32.png", "image/png"), + (ICON20, icon_file20) => ("../static/img/favicon-96x96.png", "/admin/favicon-96x96.png", "image/png"), + (ICON21, icon_file21) => ("../static/img/ms-icon-144x144.png", "/admin/ms-icon-144x144.png", "image/png"), + (ICON22, icon_file22) => ("../static/img/ms-icon-150x150.png", "/admin/ms-icon-150x150.png", "image/png"), + (ICON23, icon_file23) => ("../static/img/ms-icon-310x310.png", "/admin/ms-icon-310x310.png", "image/png"), + (ICON24, icon_file24) => ("../static/img/ms-icon-70x70.png", "/admin/ms-icon-70x70.png", "image/png"), } const INDEX_FILE: &[u8] = include_bytes!("../static/pkg/index.html"); diff --git a/thoth-app/Trunk.toml b/thoth-app/Trunk.toml index 05215f8d..2a31d91e 100644 --- a/thoth-app/Trunk.toml +++ b/thoth-app/Trunk.toml @@ -2,7 +2,7 @@ # The output dir for all final assets. dist = "pkg" # The public URL from which assets are to be served. -public_url = "/" +public_url = "/admin/" # Whether to include hash values in the output file names. filehash = false diff --git a/thoth-app/browserconfig.xml b/thoth-app/browserconfig.xml index ab092748..28b1c0e4 100644 --- a/thoth-app/browserconfig.xml +++ b/thoth-app/browserconfig.xml @@ -1,2 +1,2 @@ -#ffdd57 +#ffdd57 diff --git a/thoth-app/css/thoth.css b/thoth-app/css/thoth.css index 4037b9ed..eb821bc1 100644 --- a/thoth-app/css/thoth.css +++ b/thoth-app/css/thoth.css @@ -94,4 +94,27 @@ text-overflow: ellipsis; white-space: nowrap; display: block; +} + +.button.primary { + color: #ffffff; + background-color: #8c3f8d; + border-width: 2px; + border-radius: .375rem; + border-color: #8c3f8d; + font-weight: bold; +} +.button.primary:hover { + background-color: #af4fb0; +} +.version { + color: #f14668; + padding-left: 1em; + padding-right: 1em; + padding-bottom: calc(.5em - 1px); + font-weight: bold; +} +.version:hover { + text-decoration: underline; + color: #f14668; } \ No newline at end of file diff --git a/thoth-app/img/cover-placeholder.jpg b/thoth-app/img/cover-placeholder.jpg deleted file mode 100644 index 375f91f3..00000000 Binary files a/thoth-app/img/cover-placeholder.jpg and /dev/null differ diff --git a/thoth-app/img/thoth-banner.png b/thoth-app/img/thoth-banner.png deleted file mode 100644 index c33ad415..00000000 Binary files a/thoth-app/img/thoth-banner.png and /dev/null differ diff --git a/thoth-app/img/thoth-latin.png b/thoth-app/img/thoth-latin.png deleted file mode 100644 index f9684b4a..00000000 Binary files a/thoth-app/img/thoth-latin.png and /dev/null differ diff --git a/thoth-app/index.html b/thoth-app/index.html index 930fbf2e..ac653d1e 100644 --- a/thoth-app/index.html +++ b/thoth-app/index.html @@ -7,20 +7,20 @@ Thoth - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/thoth-app/main.js b/thoth-app/main.js new file mode 100644 index 00000000..6d84ae9e --- /dev/null +++ b/thoth-app/main.js @@ -0,0 +1,8 @@ +import init, { run_app } from "./pkg/thoth_app.js"; + +async function main() { + await init("/admin/thoth_app_bg.wasm"); + run_app(); +} + +main(); diff --git a/thoth-app/manifest.json b/thoth-app/manifest.json index f75b02c5..3b8968cb 100644 --- a/thoth-app/manifest.json +++ b/thoth-app/manifest.json @@ -12,37 +12,37 @@ "version": "0.11.18", "icons": [ { - "src": "\/android-icon-36x36.png", + "src": "\/admin\/android-icon-36x36.png", "sizes": "36x36", "type": "image\/png", "density": "0.75" }, { - "src": "\/android-icon-48x48.png", + "src": "\/admin\/android-icon-48x48.png", "sizes": "48x48", "type": "image\/png", "density": "1.0" }, { - "src": "\/android-icon-72x72.png", + "src": "\/admin\/android-icon-72x72.png", "sizes": "72x72", "type": "image\/png", "density": "1.5" }, { - "src": "\/android-icon-96x96.png", + "src": "\/admin\/android-icon-96x96.png", "sizes": "96x96", "type": "image\/png", "density": "2.0" }, { - "src": "\/android-icon-144x144.png", + "src": "\/admin\/android-icon-144x144.png", "sizes": "144x144", "type": "image\/png", "density": "3.0" }, { - "src": "\/android-icon-192x192.png", + "src": "\/admin\/android-icon-192x192.png", "sizes": "192x192", "type": "image\/png", "density": "4.0" diff --git a/thoth-app/src/component/about.rs b/thoth-app/src/component/about.rs deleted file mode 100644 index 83e535d7..00000000 --- a/thoth-app/src/component/about.rs +++ /dev/null @@ -1,50 +0,0 @@ -use yew::html; -use yew::prelude::*; - -pub struct AboutComponent {} - -impl Component for AboutComponent { - type Message = (); - type Properties = (); - - fn create(_ctx: &Context) -> Self { - AboutComponent {} - } - - fn view(&self, _ctx: &Context) -> Html { - html! { -
-

{ "About Us" }

-
-

{ "Thoth is an open metadata management and dissemination platform. As an organisation, we are focused on:" }

-
    -
  • { "creation, curation, and dissemination of high-quality metadata records which are essential for the advancement of public knowledge;" }
  • -
  • { "promoting openness in scholarly communications such as open access, open licensing, FLOSS, open data, open metadata, and open standards and protocols;" }
  • -
  • { "embracing infrastructural and platform diversity as an inherent component of a flourishing scholarly communications landscape;" }
  • -
  • { "providing high-quality solutions and services for metadata creation, management, dissemination, archiving and preservation." }
  • -
-

{ "Thoth has been developed by Javier Arias in the context of the Community-led Open Publication Infrastructures for Monographs (COPIM) project funded by UKRI and the Arcadia Fund." }

-

{ "Thoth is incorporated as a Community Interest Company in the UK, no. 14549556." }

-

{ "Address: 40 Devonshire Road, Cambridge, United Kingdom, CB1 2BL" }

-

{ "Organisation" }

-
    -
  • { "Joe Deville (Director)" }
  • -
  • { "Rupert Gatti (Director)" }
  • -
  • { "Vincent W.J. van Gerven Oei (Director)" }
  • -
  • { "Toby Steiner (COO)" }
  • -
  • { "Javier Arias (CTO)" }
  • -
  • { "Ross Higman (Software Engineer)" }
  • -
  • { "Brendan O'Connell (Software Engineer)" }
  • -
  • { "Hannah Hillen (Metadata & Publisher Outreach Specialist)" }
  • -
-

{ "Consultants" }

-
    -
  • { "Amanda Ramalho (Thoth Representative, Latin America)" }
  • -
-

{ "Support us through the " }{ "Open Book Collective" }{ "." }

-

{ "Contact us at " }{ "info@thoth.pub" }{ "." }

-
-
- } - } -} diff --git a/thoth-app/src/component/catalogue.rs b/thoth-app/src/component/catalogue.rs deleted file mode 100644 index ae2b66f0..00000000 --- a/thoth-app/src/component/catalogue.rs +++ /dev/null @@ -1,215 +0,0 @@ -use thoth_api::model::work::WorkWithRelations; -use thoth_errors::ThothError; -use yew::html; -use yew::prelude::Component; -use yew::prelude::Context; -use yew::prelude::FocusEvent; -use yew::prelude::Html; -use yew::prelude::InputEvent; -use yewtil::fetch::Fetch; -use yewtil::fetch::FetchAction; -use yewtil::fetch::FetchState; - -use crate::component::utils::Loader; -use crate::component::utils::Reloader; -use crate::models::work::works_query::FetchActionWorks; -use crate::models::work::works_query::FetchWorks; -use crate::models::work::works_query::Variables; -use crate::models::work::works_query::WorksRequest; -use crate::models::work::works_query::WorksRequestBody; -use crate::models::work::DisplayWork; - -use super::ToElementValue; - -pub struct CatalogueComponent { - limit: i32, - offset: i32, - page_size: i32, - search_query: String, - data: Vec, - result_count: i32, - fetch_data: FetchWorks, -} - -pagination_helpers! {CatalogueComponent, PAGINATION_COUNT_WORKS, SEARCH_WORKS} - -pub enum Msg { - SetFetchState(FetchActionWorks), - GetData, - PaginateData, - #[allow(dead_code)] - Search(String), - SearchQueryChanged(String), - TriggerSearch, - NextPage, - PreviousPage, -} - -impl Component for CatalogueComponent { - type Message = Msg; - type Properties = (); - - fn create(ctx: &Context) -> Self { - let offset: i32 = Default::default(); - let page_size: i32 = 10; - let limit: i32 = page_size; - let search_query: String = Default::default(); - let result_count: i32 = Default::default(); - let data = Default::default(); - let fetch_data = Default::default(); - - ctx.link().send_message(Msg::PaginateData); - - CatalogueComponent { - limit, - offset, - page_size, - search_query, - data, - result_count, - fetch_data, - } - } - - fn update(&mut self, ctx: &Context, msg: Self::Message) -> bool { - match msg { - Msg::SetFetchState(fetch_state) => { - self.fetch_data.apply(fetch_state); - self.data = match self.fetch_data.as_ref().state() { - FetchState::Fetched(body) => body.data.works.clone(), - _ => Default::default(), - }; - self.result_count = match self.fetch_data.as_ref().state() { - FetchState::Fetched(body) => body.data.work_count, - _ => Default::default(), - }; - true - } - Msg::GetData => { - ctx.link() - .send_future(self.fetch_data.fetch(Msg::SetFetchState)); - ctx.link() - .send_message(Msg::SetFetchState(FetchAction::Fetching)); - false - } - Msg::PaginateData => { - let filter = self.search_query.clone(); - let body = WorksRequestBody { - variables: Variables { - limit: Some(self.limit), - offset: Some(self.offset), - filter: Some(filter), - // Sorting option is not required on Catalogue page - order: None, - // Catalogue is public so results should never be filtered by logged-in user - publishers: None, - }, - ..Default::default() - }; - let request = WorksRequest { body }; - self.fetch_data = Fetch::new(request); - ctx.link().send_message(Msg::GetData); - false - } - Msg::Search(_) => { - // needed because of macro, but unused here - false - } - Msg::SearchQueryChanged(term) => { - self.search_query = term; - false - } - Msg::TriggerSearch => { - self.limit = self.page_size; - self.offset = 0; - ctx.link().send_message(Msg::PaginateData); - false - } - Msg::NextPage => { - if self.limit < self.result_count && !self.is_next_disabled() { - self.offset += self.page_size; - ctx.link().send_message(Msg::PaginateData); - } - false - } - Msg::PreviousPage => { - if self.offset > 0 && !self.is_previous_disabled() { - self.offset -= self.page_size; - ctx.link().send_message(Msg::PaginateData); - } - false - } - } - } - - fn view(&self, ctx: &Context) -> Html { - html! { -
-

{ "Catalogue" }

- - - { - match self.fetch_data.as_ref().state() { - FetchState::NotFetching(_) => { - html! {} - } - FetchState::Fetching(_) => html! {}, - FetchState::Fetched(_body) => html! { - { for self.data.iter().map(|w| w.as_catalogue_box()) } - }, - FetchState::Failed(_, err) => html! { - { ThothError::from(err).to_string() } - }, - } - } -
- } - } -} diff --git a/thoth-app/src/component/hero.rs b/thoth-app/src/component/hero.rs deleted file mode 100644 index 7e5861a1..00000000 --- a/thoth-app/src/component/hero.rs +++ /dev/null @@ -1,94 +0,0 @@ -use yew::function_component; -use yew::html; - -use crate::{THOTH_EXPORT_API, THOTH_GRAPHQL_API}; - -#[function_component(HeroComponent)] -pub fn hero_component() -> VNode { - let graphiql = format!("{THOTH_GRAPHQL_API}/graphiql"); - html! { -
- -
- } -} diff --git a/thoth-app/src/component/mod.rs b/thoth-app/src/component/mod.rs index d50c38c8..dd2b77a0 100644 --- a/thoth-app/src/component/mod.rs +++ b/thoth-app/src/component/mod.rs @@ -449,11 +449,9 @@ impl ToElementValue for Option { } } -pub mod about; pub mod admin; pub mod affiliations_form; pub mod books; -pub mod catalogue; pub mod chapters; pub mod contributions_form; pub mod contributor; @@ -461,7 +459,6 @@ pub mod contributors; pub mod dashboard; pub mod delete_dialogue; pub mod fundings_form; -pub mod hero; pub mod imprint; pub mod imprints; pub mod institution; diff --git a/thoth-app/src/component/navbar.rs b/thoth-app/src/component/navbar.rs index be63d0f2..6210ecda 100644 --- a/thoth-app/src/component/navbar.rs +++ b/thoth-app/src/component/navbar.rs @@ -4,9 +4,7 @@ use yew::prelude::*; use yew::virtual_dom::VNode; use yew_router::prelude::*; -use crate::route::AdminRoute; use crate::route::AppRoute; -use crate::{THOTH_EXPORT_API, THOTH_GRAPHQL_API}; pub struct NavbarComponent {} @@ -42,12 +40,11 @@ impl Component for NavbarComponent { e.prevent_default(); Msg::Logout }); - let graphiql = format!("{THOTH_GRAPHQL_API}/graphiql"); html! {