Skip to content

Commit

Permalink
Merge pull request #136 from mintlayer/dev
Browse files Browse the repository at this point in the history
Dev-02-04-2024-v-1-2-2
  • Loading branch information
owlsua authored Apr 2, 2024
2 parents 81f85b5 + 56d49eb commit fe5ee52
Show file tree
Hide file tree
Showing 60 changed files with 634 additions and 270 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/create-backup-db.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('stuff IndexedDB', () => {
return a.then(() =>
cy.wrap(null).then(() => {
cy.restoreWallet(x)
cy.contains('button', 'Create Wallet').click()
cy.contains('button', 'Add Wallet').click()
}),
)
}, cy.wrap(null))
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browser-extension",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"dependencies": {
"@mintlayer/entropy-generator": "^1.0.2",
Expand Down
3 changes: 3 additions & 0 deletions packing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ cd build
CSPHEADER="<meta http-equiv=\"Content-Security-Policy\" content=\"default-src *;img-src * 'self' data: https:;style-src-elem 'self' https:\/\/fonts.googleapis.com;font-src https:\/\/fonts.gstatic.com;\"\/>"
sed -i "s/<meta name=\"CSP\"\/>/$CSPHEADER/g" index.html

# Copying index.html to popup.html to have different entry points for popup and extended view
cp index.html popup.html

# creates zip for Firefox
mv manifestFirefox.json manifest.json
zip -r ../extFF.zip ./*
Expand Down
6 changes: 3 additions & 3 deletions public/background-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ browser.runtime.onConnect.addListener((port) => {

async function handleConnect(request, port) {
if (connectWindowId === null) {
await createPopup('index.html', async (win) => {
await createPopup('popup.html', async (win) => {
connectWindowId = win.id
setTimeout(async () => {
const response = await browser.runtime.sendMessage({
Expand All @@ -44,7 +44,7 @@ browser.runtime.onConnect.addListener((port) => {
async function handleDelegate(request) {
if (popupWindowId === null && !isPopupOpening) {
isPopupOpening = true
await createPopup('index.html', async (win) => {
await createPopup('popup.html', async (win) => {
popupWindowId = win.id
isPopupOpening = false
setTimeout(async () => {
Expand All @@ -61,7 +61,7 @@ browser.runtime.onConnect.addListener((port) => {

async function handleStake(request) {
if (popupWindowId === null) {
await createPopup('index.html', async (win) => {
await createPopup('popup.html', async (win) => {
popupWindowId = win.id
setTimeout(async () => {
await browser.runtime.sendMessage({
Expand Down
6 changes: 3 additions & 3 deletions public/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ chrome.runtime.onMessageExternal.addListener(function (
popupWindowId = true
chrome.windows.create(
{
url: chrome.runtime.getURL('index.html'),
url: chrome.runtime.getURL('popup.html'),
type: 'popup',
width: 800,
height: 600,
Expand Down Expand Up @@ -52,7 +52,7 @@ chrome.runtime.onMessageExternal.addListener(function (
popupWindowId = true
chrome.windows.create(
{
url: chrome.runtime.getURL('index.html'),
url: chrome.runtime.getURL('popup.html'),
type: 'popup',
width: 800,
height: 600,
Expand Down Expand Up @@ -80,7 +80,7 @@ chrome.runtime.onMessageExternal.addListener(function (
popupWindowId = true
chrome.windows.create(
{
url: chrome.runtime.getURL('index.html'),
url: chrome.runtime.getURL('popup.html'),
type: 'popup',
width: 800,
height: 630,
Expand Down
7 changes: 7 additions & 0 deletions public/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@media screen and (min-width: 801px) {
html {
display: flex;
justify-content: center;
padding: 30px 0 0 0;
}
}
4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<head>
<meta name="CSP" />
<meta charset="utf-8" />
<link
rel="stylesheet"
href="index.css"
/>
<link
rel="icon"
href="%PUBLIC_URL%/favicon.ico"
Expand Down
2 changes: 1 addition & 1 deletion public/manifestDefault.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Mojito - A Mintlayer Wallet",
"version": "1.2.1",
"version": "1.2.2",
"short_name": "Mojito",
"description": "Mojito is a non-custodial decentralized crypto wallet that lets you send and receive BTC and ML from any other address.",
"homepage_url": "https://www.mintlayer.org/",
Expand Down
2 changes: 1 addition & 1 deletion public/manifestFirefox.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Mojito - A Mintlayer Wallet",
"version": "1.2.1",
"version": "1.2.2",
"description": "Mojito is a non-custodial decentralized crypto wallet that lets you send and receive BTC and ML from any other address.",
"homepage_url": "https://www.mintlayer.org/",
"icons": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/images/icon-expand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ body {
.title-create {
font-size: 24px;
font-weight: bold;
margin: 8px 0 62px 0;
margin: 4rem 0 4rem 0;
}

.footnote-wrapper {
Expand Down
4 changes: 4 additions & 0 deletions src/components/basic/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const Button = ({
extraStyleClasses = [],
disabled = false,
buttonType = 'button',
onMouseEnter,
onMouseLeave,
}) => {
const classesList = ['btn', ...extraStyleClasses]
alternate && classesList.push('alternate')
Expand All @@ -32,6 +34,8 @@ const Button = ({
data-testid="button"
disabled={disabled}
type={buttonType}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
{children}
</button>
Expand Down
1 change: 1 addition & 0 deletions src/components/basic/Input/Input.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

.input::placeholder {
color: rgb(var(--color-dark-gray));
opacity: 0.2;
font-size: 1.5rem;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/basic/Logo/Logo.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

.logoContainer .logo {
width: 64px;
width: 60px;
margin: 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/basic/Logo/Logo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useEffect, useContext } from 'react'
import { SettingsContext, AccountContext } from '@Contexts'
import LogoIcon from '@Assets/images/logo96.png'
import LogoIcon from '@Assets/images/logo.svg'
import { AppInfo } from '@Constants'
import './Logo.css'

Expand Down
64 changes: 57 additions & 7 deletions src/components/basic/Tooltip/Tooltip.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,70 @@
.tooltip {
position: absolute;
top: 0;
left: 34px;
display: flex;
align-items: center;
justify-content: center;
width: 110px;
width: max-content;
max-width: 110px;
max-height: fit-content;
padding: 4px 8px;
background: rgb(var(--color-green));
border-radius: 5px;
color: rgb(var(--color-white));
font-size: 0.8rem;
opacity: 0;
transition: opacity 0.7s ease;
}

.tooltip.visible {
opacity: 1;
transition: opacity 0.7s ease;
.top {
bottom: 100%;
left: 50%;
transform: translateX(-50%);
}

.bottom {
top: 110%;
left: 50%;
transform: translateX(-50%);
}

.left {
top: 50%;
right: 110%;
transform: translateY(-50%);
}

.right {
top: 50%;
left: 110%;
transform: translateY(-50%);
}

.topLeft {
bottom: 100%;
right: 100%;
}

.topRight {
bottom: 100%;
left: 100%;
}

.bottomLeft {
top: 110%;
right: 100%;
}

.bottomRight {
top: 110%;
left: 100%;
}

.hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
clip: rect(0 0 0 0);
overflow: hidden;
}
16 changes: 14 additions & 2 deletions src/components/basic/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import './Tooltip.css'

const Tooltip = ({ message, visible }) => {
const Tooltip = ({ message, visible, position }) => {
const orientation = [
'top',
'bottom',
'left',
'right',
'topLeft',
'topRight',
'bottomLeft',
'bottomRight',
]
return (
<span
className={`tooltip ${visible && 'visible'}`}
className={`tooltip ${
orientation.includes(position) ? position : 'bottom'
} ${!visible && 'hidden'}`}
data-testid="tooltip"
>
{message}
Expand Down
40 changes: 30 additions & 10 deletions src/components/basic/Tooltip/Tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,51 @@ import { render, screen } from '@testing-library/react'
import Tooltip from './Tooltip'

describe('Tooltip', () => {
it('renders correctly when visible', () => {
it('renders the tooltip message', () => {
render(
<Tooltip
message="Test tooltip"
message="Test message"
visible={true}
position="top"
/>,
)
const tooltipElement = screen.getByText(/Test message/i)
expect(tooltipElement).toBeInTheDocument()
})

it('applies the correct position class', () => {
render(
<Tooltip
message="Test message"
visible={true}
position="top"
/>,
)
const tooltipElement = screen.getByTestId('tooltip')
expect(tooltipElement).toHaveTextContent('Test tooltip')
expect(tooltipElement).toHaveClass('tooltip')
expect(tooltipElement).toHaveClass('visible')
expect(tooltipElement).toHaveClass('top')
})

it('renders correctly when not visible', () => {
it('applies the hidden class when not visible', () => {
render(
<Tooltip
message="Test tooltip"
message="Test message"
visible={false}
position="top"
/>,
)
const tooltipElement = screen.getByTestId('tooltip')
expect(tooltipElement).toHaveClass('hidden')
})

it('defaults to the bottom position if an invalid position is provided', () => {
render(
<Tooltip
message="Test message"
visible={true}
position="invalid"
/>,
)
const tooltipElement = screen.getByTestId('tooltip')
expect(tooltipElement).toHaveTextContent('Test tooltip')
expect(tooltipElement).toHaveClass('tooltip')
expect(tooltipElement).not.toHaveClass('visible')
expect(tooltipElement).toHaveClass('bottom')
})
})
2 changes: 1 addition & 1 deletion src/components/composed/AddWallet/AddWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const AddWallet = ({
const getMnemonics = () =>
wordsFields.reduce((acc, word) => `${acc} ${word.value}`, '').trim()

const submitButtonTitle = step === 3 ? 'Create Wallet' : 'Next'
const submitButtonTitle = step === 3 ? 'Add Wallet' : 'Next'

const changePassHandle = (value) => {
setPass(value)
Expand Down
2 changes: 1 addition & 1 deletion src/components/composed/AddWallet/AddWallet.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('AddWallet', () => {

const submitButton = screen.getByTestId('button')
expect(submitButton).toBeInTheDocument()
expect(submitButton).toHaveTextContent('Create Wallet')
expect(submitButton).toHaveTextContent('Add Wallet')
})

test('changes step on submit button click', () => {
Expand Down
Loading

0 comments on commit fe5ee52

Please sign in to comment.