-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1177 from nymtech/feature/wallet-1.0.1-tweaks
Wallet 1.0.1 tweaks
- Loading branch information
Showing
22 changed files
with
392 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Nym Wallet Storybook | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'nym-wallet/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: custom-runner-linux | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install rsync | ||
run: sudo apt-get install rsync | ||
- uses: rlespinasse/github-slug-action@v3.x | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
- name: Setup yarn | ||
run: npm install -g yarn | ||
- name: Build dependencies | ||
run: yarn && yarn build | ||
- name: Build storybook | ||
run: yarn storybook:build | ||
working-directory: ./nym-wallet | ||
- name: Deploy branch to CI www (storybook) | ||
continue-on-error: true | ||
uses: easingthemes/ssh-deploy@main | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.CI_WWW_SSH_PRIVATE_KEY }} | ||
ARGS: "-rltgoDzvO --delete" | ||
SOURCE: "nym-wallet/storybook-static/" | ||
REMOTE_HOST: ${{ secrets.CI_WWW_REMOTE_HOST }} | ||
REMOTE_USER: ${{ secrets.CI_WWW_REMOTE_USER }} | ||
TARGET: ${{ secrets.CI_WWW_REMOTE_TARGET }}/wallet-${{ env.GITHUB_REF_SLUG }} | ||
EXCLUDE: "/dist/, /node_modules/" | ||
- name: Keybase - Node Install | ||
run: npm install | ||
working-directory: .github/workflows/support-files | ||
- name: Keybase - Send Notification | ||
env: | ||
NYM_NOTIFICATION_KIND: nym-wallet | ||
NYM_PROJECT_NAME: "nym-wallet" | ||
NYM_CI_WWW_BASE: "${{ secrets.NYM_CI_WWW_BASE }}" | ||
NYM_CI_WWW_LOCATION: "wallet-${{ env.GITHUB_REF_SLUG }}" | ||
GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}" | ||
GIT_BRANCH: "${GITHUB_REF##*/}" | ||
KEYBASE_NYMBOT_USERNAME: "${{ secrets.KEYBASE_NYMBOT_USERNAME }}" | ||
KEYBASE_NYMBOT_PAPERKEY: "${{ secrets.KEYBASE_NYMBOT_PAPERKEY }}" | ||
KEYBASE_NYMBOT_TEAM: "${{ secrets.KEYBASE_NYMBOT_TEAM }}" | ||
KEYBASE_NYM_CHANNEL: "ci-nym-wallet" | ||
IS_SUCCESS: "${{ job.status == 'success' }}" | ||
uses: docker://keybaseio/client:stable-node | ||
with: | ||
args: .github/workflows/support-files/notifications/entry_point.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Handlebars = require('handlebars'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
async function addToContextAndValidate(context) { | ||
if (!context.env.NYM_CI_WWW_LOCATION) { | ||
throw new Error('Please ensure the env var NYM_CI_WWW_LOCATION is set'); | ||
} | ||
if (!context.env.NYM_CI_WWW_BASE) { | ||
throw new Error('Please ensure the env var NYM_CI_WWW_BASE is set'); | ||
} | ||
} | ||
|
||
async function getMessageBody(context) { | ||
const source = fs | ||
.readFileSync( | ||
context.env.IS_SUCCESS === 'true' | ||
? path.resolve(__dirname, 'templates', 'success') | ||
: path.resolve(__dirname, 'templates', 'failure'), | ||
) | ||
.toString(); | ||
const template = Handlebars.compile(source); | ||
return template(context); | ||
} | ||
|
||
module.exports = { | ||
addToContextAndValidate, | ||
getMessageBody, | ||
}; |
11 changes: 11 additions & 0 deletions
11
.github/workflows/support-files/nym-wallet/templates/failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 | ||
> :rocket: {{ env.NYM_PROJECT_NAME }} | ||
> 🔴 **FAILURE** :cry: | ||
> `branch` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/tree/{{ env.GIT_BRANCH_NAME }} | ||
> `commit` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/commit/{{ env.GITHUB_SHA }} | ||
> `build ` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }} | ||
|
||
Commit message: | ||
``` | ||
{{ env.GIT_COMMIT_MESSAGE }} | ||
``` |
15 changes: 15 additions & 0 deletions
15
.github/workflows/support-files/nym-wallet/templates/success
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 | ||
> :rocket: {{ env.NYM_PROJECT_NAME }} | ||
> ✅ **SUCCESS** | ||
|
||
> ➡️➡️➡️➡️➡️ **View output:** | ||
> `storybook`: https://{{ env.NYM_CI_WWW_LOCATION }}.{{ env.NYM_CI_WWW_BASE }} | ||
|
||
> `branch` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/tree/{{ env.GIT_BRANCH_NAME }} | ||
> `commit` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/commit/{{ env.GITHUB_SHA }} | ||
> `build ` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }} | ||
|
||
Commit message by `{{ env.GITHUB_ACTOR }}` at {{ timestamp }}: | ||
``` | ||
{{ env.GIT_COMMIT_MESSAGE }} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-disable no-param-reassign */ | ||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); | ||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); | ||
|
||
module.exports = { | ||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'], | ||
framework: '@storybook/react', | ||
core: { | ||
builder: 'webpack5', | ||
}, | ||
// webpackFinal: async (config, { configType }) => { | ||
// // `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION' | ||
// // You can change the configuration based on that. | ||
// // 'PRODUCTION' is used when building the static version of storybook. | ||
webpackFinal: async (config) => { | ||
config.module.rules.forEach((rule) => { | ||
// look for SVG import rule and replace | ||
// NOTE: the rule before modification is /\.(svg|ico|jpg|jpeg|png|apng|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/ | ||
if (rule.test?.toString().includes('svg')) { | ||
rule.test = /\.(ico|jpg|jpeg|png|apng|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/; | ||
} | ||
}); | ||
|
||
// handle asset loading with this | ||
config.module.rules.unshift({ | ||
test: /\.svg(\?.*)?$/i, | ||
issuer: /\.[jt]sx?$/, | ||
use: ['@svgr/webpack'], | ||
}); | ||
|
||
config.resolve.extensions = ['.tsx', '.ts', '.js']; | ||
config.resolve.plugins = [new TsconfigPathsPlugin()]; | ||
|
||
config.plugins.push(new ForkTsCheckerWebpackPlugin({ | ||
typescript: { | ||
mode: 'write-references', | ||
diagnosticOptions: { | ||
semantic: true, | ||
syntactic: true, | ||
}, | ||
}, | ||
})); | ||
|
||
if (!config.resolve.alias) { | ||
config.resolve.alias = {}; | ||
} | ||
|
||
config.resolve.alias['@tauri-apps/api'] = `${__dirname}/mocks/tauri`; | ||
|
||
// Return the altered config | ||
return config; | ||
}, | ||
features: { | ||
emotionAlias: false, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* This is a mock for Tauri's API package (@tauri-apps/api), to prevent stories from being excluded, because they either use | ||
* or import dependencies that use Tauri. | ||
*/ | ||
|
||
module.exports = { | ||
invoke: (operation) => { | ||
console.error(`Tauri cannot be used in Storybook. The operation requested was "${operation}". You can add mock responses to "nym_wallet/.storybook/mocks/tauri.js" if you need. The default response is "void".`); | ||
return new Promise((resolve, reject) => { | ||
reject(new Error(`Tauri operation ${operation} not available in storybook.`)); | ||
}); | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* This is a mock for Tauri's API package (@tauri-apps/api/window), to prevent stories from being excluded, because they either use | ||
* or import dependencies that use Tauri. | ||
*/ | ||
|
||
module.exports = { | ||
appWindow: { | ||
maximize: () => undefined, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { NymWalletThemeWithMode } from '../src/theme/NymWalletTheme'; | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
} | ||
|
||
const withThemeProvider = (Story, context) => ( | ||
<NymWalletThemeWithMode mode="light"> | ||
<Story {...context} /> | ||
</NymWalletThemeWithMode> | ||
); | ||
|
||
export const decorators = [withThemeProvider]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<title>Nym Wallet</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
<head> | ||
<meta charset='utf-8' /> | ||
<meta name='viewport' content='width=device-width, initial-scale=1' /> | ||
<title>Nym Wallet</title> | ||
</head> | ||
<body> | ||
<div id='root'></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as React from 'react'; | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import { Box, Typography } from '@mui/material'; | ||
import { ClientAddressDisplay } from './ClientAddress'; | ||
|
||
export default { | ||
title: 'Wallet / Client Address', | ||
component: ClientAddressDisplay, | ||
} as ComponentMeta<typeof ClientAddressDisplay>; | ||
|
||
const Template: ComponentStory<typeof ClientAddressDisplay> = (args) => ( | ||
<Box display="flex" alignContent="center"> | ||
<ClientAddressDisplay {...args} /> | ||
</Box> | ||
); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
address: 'n222gnd9k6rytn6tz7pf8d2d4dawl7e9cr26111', | ||
}; | ||
|
||
export const WithCopy = Template.bind({}); | ||
WithCopy.args = { | ||
address: 'n222gnd9k6rytn6tz7pf8d2d4dawl7e9cr26111', | ||
withCopy: true, | ||
}; | ||
|
||
export const WithLabel = Template.bind({}); | ||
WithLabel.args = { | ||
withLabel: true, | ||
address: 'n222gnd9k6rytn6tz7pf8d2d4dawl7e9cr26111', | ||
}; | ||
|
||
export const ShowEntireAddress = Template.bind({}); | ||
ShowEntireAddress.args = { | ||
withLabel: true, | ||
showEntireAddress: true, | ||
address: 'n222gnd9k6rytn6tz7pf8d2d4dawl7e9cr26111', | ||
}; | ||
|
||
export const Empty = Template.bind({}); | ||
Empty.args = {}; | ||
|
||
export const EmptyWithLabelAndCopy = Template.bind({}); | ||
EmptyWithLabelAndCopy.args = { | ||
withLabel: true, | ||
withCopy: true, | ||
}; |
Oops, something went wrong.