From 21dc0cb3b429a0f6bbccf3e6061468cba06d3c60 Mon Sep 17 00:00:00 2001 From: GlooriousWalrus Date: Sat, 2 Mar 2024 14:06:31 +0200 Subject: [PATCH] chore: remove unneeded ghactions ymls, move logo a bit --- .github/workflows/static.yml | 49 -------------------------------- site/src/pages/transliterator.rs | 16 +++++++++-- 2 files changed, 14 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml deleted file mode 100644 index cd8ac9d..0000000 --- a/.github/workflows/static.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - # Single deploy job since we're just deploying - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Setup Yarn - # You may pin to the exact commit or the version. - # uses: mskelton/setup-yarn@3c5d9b1e9b3fef69d05b4968efb613594da89f87 - uses: mskelton/setup-yarn@v1.6.0 - - name: build - run: yarn install_trunk && yarn build - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - # Upload entire repository - path: './site/dist/' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/site/src/pages/transliterator.rs b/site/src/pages/transliterator.rs index 236e395..fdee18b 100644 --- a/site/src/pages/transliterator.rs +++ b/site/src/pages/transliterator.rs @@ -9,9 +9,21 @@ use web_sys::MouseEvent; pub fn copy_selected_text_to_clipboard(el: MouseEvent, content: String) { log::warn!("Copying text to clipboard.."); + + let transforming_class = + use_context::>().expect("to have found the getter provided"); + + let text = match transforming_class.get().as_str() { + "capitalize" => uppercase_words(&content), // Convert to String for consistency + "uppercase" => content.to_uppercase(), // Returns a String, so it's owned + "lowercase" => content.to_lowercase(), // Returns a String + "normal-case" => content, + _ => "".to_string(), + }; + #[cfg(web_sys_unstable_apis)] if let Some(clipboard) = window().navigator().clipboard() { - clipboard.write_text(&content); + clipboard.write_text(text); } else { log::error!("Clipboard is not supported"); } @@ -279,7 +291,7 @@ fn Name(name: ReadSignal) -> impl IntoView { "uppercase" => name.get().to_uppercase(), // Returns a String, so it's owned "lowercase" => name.get().to_lowercase(), // Returns a String "normal-case" => name.get(), - _ => "wtf".to_string(), + _ => "".to_string(), } } }