diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index f790447..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,14 +0,0 @@
-module.exports = {
- root: true,
- env: {
- browser: true,
- node: true,
- },
- parser: 'vue-eslint-parser',
- parserOptions: {
- parser: '@typescript-eslint/parser',
- },
- extends: ['@nuxtjs/eslint-config-typescript', 'plugin:prettier/recommended'],
- plugins: [],
- rules: {},
-}
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index 5eb8719..c9da7dc 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -1,4 +1,4 @@
-name: Pages
+name: Deploy
on:
push:
@@ -6,28 +6,55 @@ on:
- 'main'
workflow_dispatch:
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+ pages: write
+ id-token: write
+
jobs:
- pages:
+ build:
runs-on: ubuntu-latest
- environment: github_pages
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
+
+ - name: Enable corepack
+ run: corepack enable pnpm
+
+ - name: Setup node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: 'pnpm'
- - name: Setup node env
- uses: actions/setup-node@v3
+ - name: Restore cache
+ uses: actions/cache@v4
with:
- node-version: '16.20.0'
+ path: |
+ dist
+ .nuxt
+ key: ${{ runner.os }}-nuxt-build-${{ hashFiles('dist') }}
+ restore-keys: |
+ ${{ runner.os }}-nuxt-build-
- - name: Install Dependencies
- run: yarn
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
- - name: Generate
- run: yarn generate
+ - name: Static HTML export with Nuxt
+ run: pnpm run generate
- - name: Deploy
- uses: peaceiris/actions-gh-pages@v3
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: .output/public
- cname: mywitwallet.com
+ path: ./dist
+
+ deploy:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.gitignore b/.gitignore
index 398011d..1e7da66 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ dist
.DS_Store
assets/.DS_Store
assets/svg/.DS_Store
+docs/** */
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..43a8ebe
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,37 @@
+# Ignore build output directories
+.nuxt/
+.output/
+dist/
+docs/
+DEBUG=1/** */
+
+# Ignore node modules
+node_modules/
+
+# Ignore specific configuration files
+*.config.js
+
+# Ignore environment variables files
+.env
+.env.*
+
+# Ignore lock files
+yarn.lock
+package-lock.json
+
+# Ignore logs
+*.log
+
+# Ignore compiled files
+*.min.js
+*.min.css
+
+# Ignore specific file types
+*.png
+*.jpg
+*.jpeg
+*.gif
+*.svg
+
+# Ignore other generated files
+coverage/
\ No newline at end of file
diff --git a/components/DownloadBtn.vue b/components/DownloadBtn.vue
index 5976ad5..1f049fe 100644
--- a/components/DownloadBtn.vue
+++ b/components/DownloadBtn.vue
@@ -1,31 +1,58 @@
-
-
+
+
- {{ $t('head.title') }}
+
-
-
+
diff --git a/constants.ts b/constants.ts
index b0bcf65..b634c29 100644
--- a/constants.ts
+++ b/constants.ts
@@ -25,6 +25,8 @@ export const languages = [
export const fallbackLocale = 'en'
export const DEFAULT_OS = 'Linux'
+export const GITHUB_RELEASE_URL =
+ 'https://github.com/witnet/sheikah/releases/latest'
export const URL_RELEASE_BASE =
'https://api.github.com/repos/witnet/my-wit-wallet/releases/latest'
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 0000000..4b65541
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,47 @@
+import globals from 'globals'
+import pluginJs from "@eslint/js";
+import tseslint from "typescript-eslint";
+import pluginVue from "eslint-plugin-vue";
+import eslintConfigPrettier from "eslint-config-prettier";
+import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
+
+export default createConfigForNuxt().prepend(
+ pluginJs.configs.recommended,
+ ...tseslint.configs.recommended,
+ ...pluginVue.configs["flat/strongly-recommended"],
+ eslintConfigPrettier,
+ {
+ ignores: ['node_modules', 'dist', 'public', '.nuxt', 'docs/**/*', 'DEBUG=1/**/*', '.output', 'docs/_nuxt/*'],
+ },
+ {
+ files: ['pages/*.vue'],
+ rules: {
+ 'vue/multi-word-component-names': 0,
+ "vue/html-self-closing": ["error", {
+ "html": {
+ "void": "always",
+ "normal": "always",
+ "component": "always"
+ },
+ "svg": "always",
+ "math": "always"
+ }]
+ },
+ },
+ {
+ files: ['**/*.vue', '**/*.ts'],
+ languageOptions: {
+ globals: {
+ ...globals.browser,
+ ...globals.node
+ },
+ parserOptions: {
+ parser: {
+ ts: tseslint.parser
+ },
+ ecmaVersion: 2020,
+ sourceType: 'module',
+ },
+ },
+ },
+)
diff --git a/getBrowserOs.ts b/getBrowserOs.ts
index 470367a..9d45ac7 100644
--- a/getBrowserOs.ts
+++ b/getBrowserOs.ts
@@ -1,7 +1,31 @@
-import { DEFAULT_OS } from './constants'
+export function getBrowserOs(navigator: Navigator) {
+ return navigator.userAgentData?.platform
+ ? detectPlatformWithUserAgentData(navigator)
+ : detectPlatform(navigator)
+}
+
+const detectPlatformWithUserAgentData = (navigator: Navigator) => {
+ const userAgentData: NavigatorUAData | undefined = navigator.userAgentData
+ return userAgentData?.platform.toLowerCase()
+}
-export function getBrowserOs(navigator: any) {
- const supportedOs = ['Win', 'Mac', 'Linux', 'MacIntel']
- const platform = navigator.platform
- return supportedOs.find((os) => platform.includes(os)) || DEFAULT_OS
+const detectPlatform = (navigator: Navigator): string | undefined => {
+ const ua = navigator.userAgent.toLowerCase().replace(/^mozilla\/\d\.\d\W/, '')
+ const mobiles: Record = {
+ iphone: /iphone/,
+ ipad: /ipad|macintosh/,
+ android: /android/,
+ }
+ const desktops: Record = {
+ windows: /win/,
+ macos: /macintosh/,
+ linux: /linux/,
+ }
+ // Determine the operating system
+ const mobileOS = Object.keys(mobiles).find(
+ (os) => mobiles[os].test(ua) && navigator.maxTouchPoints >= 1,
+ )
+ const desktopOS = Object.keys(desktops).find((os) => desktops[os].test(ua))
+ const os = mobileOS || desktopOS
+ return os
}
diff --git a/getLatestRelease.ts b/getLatestRelease.ts
index 09e3202..abd6810 100644
--- a/getLatestRelease.ts
+++ b/getLatestRelease.ts
@@ -1,39 +1,77 @@
-import axios from 'axios'
-import { URL_RELEASE_BASE } from './constants'
-import { getBrowserOs } from '@/getBrowserOs'
+import { GITHUB_RELEASE_URL } from './constants'
-type Release = {
- platform: String
- releaseUrl: String
- downloadName: String
+export type Release = {
+ platform: string
+ releaseUrl: string
+ downloadName: string | null
}
-export async function getLatestRelease(navigator: any): Promise {
- return await axios.get(URL_RELEASE_BASE).then(async (result: any) => {
- const os = await getBrowserOs(navigator).toLowerCase()
- const macRelease = await result.data.assets.find((asset: any) => {
- return asset.browser_download_url.includes('myWitWallet.dmg')
- })
- const linuxRelease = await result.data.assets.find((asset: any) =>
- asset.browser_download_url.includes('linux.tar.gz')
- )
+export type LatestReleaseResponse = {
+ assets: Array
+}
+
+export type ReleaseAsset = {
+ browser_download_url: string
+ name: string | null
+}
+
+export function getStoreRelease({ os }: { os: string }): Release | undefined {
+ const iosLink = {
+ platform: 'iOS',
+ releaseUrl: 'https://apps.apple.com/cl/app/mywitwallet/id6449979271',
+ downloadName: null,
+ }
+ const storeReleases: Record = {
+ iphone: iosLink,
+ ipad: iosLink,
+ android: {
+ platform: 'Android',
+ releaseUrl:
+ 'https://play.google.com/store/apps/details?id=io.witnet.myWitWallet&hl=es_419&pli=1',
+ downloadName: null,
+ },
+ windows: {
+ platform: 'Windows',
+ releaseUrl: 'https://apps.microsoft.com/detail/9PN09DKWPL57',
+ downloadName: null,
+ },
+ }
+ if (storeReleases[os]) {
+ return storeReleases[os]
+ }
+}
+
+export function getLatestRelease({
+ os,
+ data,
+}: {
+ os: string
+ data: LatestReleaseResponse | undefined
+}): Release | null {
+ if (data) {
+ const macRelease: ReleaseAsset = data.assets.find(
+ (asset: ReleaseAsset) => {
+ return asset.browser_download_url.includes('myWitWallet.dmg')
+ },
+ ) ?? { browser_download_url: GITHUB_RELEASE_URL, name: null }
+ const linuxRelease: ReleaseAsset = data.assets.find(
+ (asset: ReleaseAsset) =>
+ asset.browser_download_url.includes('linux.tar.gz'),
+ ) ?? { browser_download_url: GITHUB_RELEASE_URL, name: null }
+
const release: Record = {
linux: {
platform: 'GNU / Linux',
releaseUrl: linuxRelease.browser_download_url,
downloadName: linuxRelease.name,
},
- win: {
- platform: 'Windows',
- releaseUrl: 'https://apps.microsoft.com/detail/9PN09DKWPL57',
- downloadName: 'myWitWallet',
- },
- mac: {
+ macos: {
platform: 'Mac OS',
releaseUrl: macRelease.browser_download_url,
downloadName: macRelease.name,
},
}
return release[os]
- })
+ }
+ return null
}
diff --git a/locales/en.json b/locales/en.json
index 800c36a..477eb19 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -8,6 +8,7 @@
"my_wit_wallet": "myWitWallet"
},
"title": "Get myWitWallet,{0} your Witnet light wallet",
- "download": "Download myWitWallet for {platform}",
+ "downloadLink": "Download myWitWallet for {platform}",
+ "githubLink": "Download myWitWallet on GitHub",
"source_code": "Check out the source code on {github}"
}
diff --git a/nuxt.config.ts b/nuxt.config.ts
index faff278..84790d5 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -1,9 +1,13 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
- ssr: false,
+ ssr: true,
+
app: {
baseURL: '/',
head: {
+ htmlAttrs: {
+ lang: 'en',
+ },
title:
'myWitWallet: Your Secure & Instant Non-Custodial Wallet for Witnet',
meta: [
@@ -30,7 +34,6 @@ export default defineNuxtConfig({
},
{ name: 'og:image', content: '/my-wit-wallet.png' },
{ name: 'og:url', content: 'https://myWitWallet.app' },
- { name: 'og:locale:alternate', content: 'es_ES' },
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
@@ -41,19 +44,19 @@ export default defineNuxtConfig({
],
},
},
- css: ['~/styles/colors.scss', '~/styles/main.scss'],
+
+ css: ['~/styles/main.scss'],
vite: {
css: {
preprocessorOptions: {
scss: {
- additionalData: "@import '@/styles/element-variables.scss';",
+ api: 'modern-compiler',
+ additionalData: '@use "~/styles/colors.scss" as *;',
},
},
},
},
components: true,
- modules: ['@element-plus/nuxt'],
- elementPlus: {
- components: ['ElButton'],
- },
+
+ compatibilityDate: '2024-11-19',
})
diff --git a/package.json b/package.json
index e24eb7e..33368cc 100644
--- a/package.json
+++ b/package.json
@@ -1,37 +1,37 @@
{
- "name": "nuxt-app",
+ "name": "my-wit-wallet-website",
"private": true,
+ "type": "module",
"scripts": {
- "deploy": "gh-pages --dotfiles -d .output/public --repo git@github.com:witnet/my-wit-wallet-website.git --remote upstream",
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxi generate",
"preview": "nuxi preview",
"postinstall": "nuxi prepare",
- "lint:js": "eslint --ext \".ts,.vue\" --ignore-path .gitignore .",
+ "lint:js": "eslint -c eslint.config.js --ignore-pattern .gitignore .",
"lint:prettier": "prettier --check .",
- "lint": "yarn lint:js && yarn lint:prettier",
- "lintfix": "prettier --write --list-different . && yarn lint:js --fix"
+ "lint": "pnpm lint:js && pnpm lint:prettier",
+ "lintfix": "prettier --write --list-different . && pnpm lint:js --fix"
},
"devDependencies": {
- "@element-plus/nuxt": "^1.0.5",
- "@nuxtjs/eslint-config-typescript": "^12.0.0",
+ "@eslint/js": "^9.15.0",
+ "@nuxt/eslint-config": "^0.7.1",
+ "@nuxtjs/eslint-config-typescript": "^12.1.0",
"@types/node": "^18",
"@typescript-eslint/parser": "^5.59.5",
- "element-plus": "^2.3.4",
- "eslint": "^8.40.0",
- "eslint-config-prettier": "^8.8.0",
- "eslint-plugin-prettier": "^4.2.1",
- "nuxt": "^3.4.3",
- "prettier": "^2.8.8",
- "sass": "^1.62.1",
- "sass-loader": "^13.2.2",
- "typescript": "^5.0.4",
+ "eslint-config-prettier": "^9.1.0",
+ "eslint-plugin-prettier": "^5.1.2",
+ "nuxt": "^3.12.4",
+ "prettier": "3.3.3",
+ "sass": "^1.69.7",
+ "typescript": "^5.5.4",
+ "user-agent-data-types": "^0.4.2",
"vue-i18n": "^9.2.2"
},
"dependencies": {
"axios": "^1.4.0",
- "gh-pages": "^5.0.0"
+ "eslint": "^9.15.0",
+ "typescript-eslint": "^8.15.0"
},
"repository": {
"type": "git",
diff --git a/pages/index.vue b/pages/index.vue
index 3629799..64e1ca4 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -15,7 +15,9 @@
{{ $t('description') }}
-
+
+
+