Skip to content

Commit

Permalink
Sample vue app (#40)
Browse files Browse the repository at this point in the history
* feat(vue): initial vue commit

* feat(vue): init typescript

* feat(vue): connect wallet working

* feat(vue): minors

* feat(vue): update yarn.lock
  • Loading branch information
darrenvechain authored Nov 1, 2023
1 parent ef95049 commit fb9ca9f
Show file tree
Hide file tree
Showing 27 changed files with 1,919 additions and 137 deletions.
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"eslint.workingDirectories": [
{
"mode": "auto"
}
]
"eslint.workingDirectories": [
{
"mode": "auto"
}
]
}
10 changes: 5 additions & 5 deletions apps/sample-react-app/src/Constants/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WalletSource } from '@vechain/wallet-kit';
import type { WalletSource } from '@vechain/wallet-kit';

export const NODE_URL = 'https://testnet.vechain.org/';
export const NODE_NETWORK = 'test';
Expand All @@ -11,19 +11,19 @@ interface SourceInfo {
const baseLogoUrl = `${process.env.PUBLIC_URL}/images/logo`;

export const WalletSources: Record<WalletSource, SourceInfo> = {
[WalletSource.WalletConnect]: {
'wallet-connect': {
name: 'Wallet Connect',
logo: `${baseLogoUrl}/wallet-connect-logo.png`,
},
[WalletSource.VeWorldExtension]: {
'veworld-extension': {
name: 'VeWorld Extension',
logo: `${baseLogoUrl}/veworld_black.png`,
},
[WalletSource.Sync]: {
sync: {
name: 'Sync',
logo: `${baseLogoUrl}/sync.png`,
},
[WalletSource.Sync2]: {
sync2: {
name: 'Sync 2',
logo: `${baseLogoUrl}/sync2.png`,
},
Expand Down
23 changes: 23 additions & 0 deletions apps/sample-vue-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
29 changes: 29 additions & 0 deletions apps/sample-vue-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# sample-vue-app

## Project setup

```
yarn install
```

### Compiles and hot-reloads for development

```
yarn serve
```

### Compiles and minifies for production

```
yarn build
```

### Lints and fixes files

```
yarn lint
```

### Customize configuration

See [Configuration Reference](https://cli.vuejs.org/config/).
3 changes: 3 additions & 0 deletions apps/sample-vue-app/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@vue/cli-plugin-babel/preset'],
};
53 changes: 53 additions & 0 deletions apps/sample-vue-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "sample-vue-app",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "vue-cli-service build",
"dev": "vue-cli-service serve",
"lint": "vue-cli-service lint"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
],
"eslintConfig": {
"env": {
"node": true
},
"parserOptions": {
"parser": "@typescript-eslint/parser"
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript"
],
"rules": {},
"root": true
},
"dependencies": {
"@vechain/wallet-kit": "*",
"core-js": "^3.8.3",
"node-polyfill-webpack-plugin": "^2.0.1",
"vue": "^3.2.13",
"vue-class-component": "^8.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vechain/repo-config": "https://github.com/vechainfoundation/repo-config#v0.0.2",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-typescript": "^9.1.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"typescript": "~4.5.5"
}
}
Binary file added apps/sample-vue-app/public/favicon.ico
Binary file not shown.
17 changes: 17 additions & 0 deletions apps/sample-vue-app/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
54 changes: 54 additions & 0 deletions apps/sample-vue-app/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>
<ConnexProvider>
<img alt="Vue logo" src="./assets/logo.png" />
<div id="app">
<button class="btn" type="button" @click="showModal">
Open Modal!
</button>

<ConnectWalletModal v-show="isModalVisible" @close="closeModal" />
</div>
</ConnexProvider>
</template>

<script lang="ts">
import ConnectWalletModal from './components/ConnectWalletModal.vue';
import { defineComponent, ref } from 'vue';
import ConnexProvider from '@/connex/ConnexProvider.vue';
export default defineComponent({
components: {
ConnexProvider,
ConnectWalletModal,
},
setup() {
const isModalVisible = ref(false);
const showModal = () => {
isModalVisible.value = true;
};
const closeModal = () => {
isModalVisible.value = false;
};
return {
isModalVisible,
showModal,
closeModal,
};
},
});
</script>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
Binary file added apps/sample-vue-app/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fb9ca9f

Please sign in to comment.