diff --git a/.github/workflows/client-image.yml b/.github/workflows/client-image.yml index 36fb5989..8628eac7 100644 --- a/.github/workflows/client-image.yml +++ b/.github/workflows/client-image.yml @@ -46,10 +46,8 @@ jobs: with: images: recksato/robosats-client tags: | - type=ref,event=branch type=ref,event=pr type=ref,event=tag - type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=sha,enable=true,priority=100,prefix=,suffix=,format=short type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} @@ -71,5 +69,4 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/coordinator-image.yml b/.github/workflows/coordinator-image.yml index d078aafa..1c5a7472 100644 --- a/.github/workflows/coordinator-image.yml +++ b/.github/workflows/coordinator-image.yml @@ -35,10 +35,8 @@ jobs: with: images: recksato/robosats tags: | - type=ref,event=branch type=ref,event=pr type=ref,event=tag - type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=sha,enable=true,priority=100,prefix=,suffix=,format=short type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} @@ -57,5 +55,4 @@ jobs: context: . push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/frontend-build.yml b/.github/workflows/frontend-build.yml index 6478c69a..43592a52 100644 --- a/.github/workflows/frontend-build.yml +++ b/.github/workflows/frontend-build.yml @@ -54,17 +54,16 @@ jobs: name: main-js path: frontend/static/frontend/main.js - invoke-docker-builds: - if: inputs.semver == '' - runs-on: ubuntu-latest - needs: build - steps: + # Invoke pre-release image build if this was not a tag push + # Docker images tagged only with short commit hash - name: 'Invoke Coodinator Image CI' + if: inputs.semver == '' uses: benc-uk/workflow-dispatch@v1 with: workflow: 'Coodinator Image CI' token: ${{ secrets.PERSONAL_TOKEN }} - name: 'Invoke Client App Build CI/CD workflow' + if: inputs.semver == '' uses: benc-uk/workflow-dispatch@v1 with: workflow: 'Client App Image CI/CD' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75a32239..7b20699a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -96,6 +96,4 @@ jobs: # upload_url: ${{ steps.create-release.outputs.upload_url }} # asset_path: app-release.apk # asset_name: robosats-${{ needs.check-versions.outputs.semver }}.apk - # asset_content_type: application/apk - - \ No newline at end of file + # asset_content_type: application/apk \ No newline at end of file diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js index fe0713ad..3879b8bb 100644 --- a/frontend/src/components/BookPage.js +++ b/frontend/src/components/BookPage.js @@ -81,13 +81,13 @@ class BookPage extends Component { // Colors for the status badges statusBadgeColor(status) { - if (status == 'Active') { + if (status === 'Active') { return 'success'; } - if (status == 'Seen recently') { + if (status === 'Seen recently') { return 'warning'; } - if (status == 'Inactive') { + if (status === 'Inactive') { return 'error'; } } @@ -167,7 +167,12 @@ class BookPage extends Component { return ( - + @@ -307,7 +312,13 @@ class BookPage extends Component { renderCell: (params) => { return (
- +
); }, diff --git a/frontend/src/components/BottomBar.js b/frontend/src/components/BottomBar.js index 680b181c..3bffb5ac 100644 --- a/frontend/src/components/BottomBar.js +++ b/frontend/src/components/BottomBar.js @@ -19,6 +19,7 @@ import MediaQuery from 'react-responsive'; import Flags from 'country-flag-icons/react/3x2'; import { Link as LinkRouter } from 'react-router-dom'; import { apiClient } from '../services/api'; +import RobotAvatar from './Robots/RobotAvatar'; // Icons import BarChartIcon from '@mui/icons-material/BarChart'; @@ -204,29 +205,16 @@ class BottomBar extends Component { } > - 0) & !this.props.profileShown ? '' : null + 0) & !this.props.profileShown + ? 'primary' + : undefined } - color='primary' - > - this.props.setAppState({ avatarLoaded: true }), - }} - src={ - this.props.nickname - ? window.location.origin + - '/static/assets/avatars/' + - this.props.nickname + - '.png' - : null - } - /> - + nickname={this.props.nickname} + onLoad={() => this.props.setAppState({ avatarLoaded: true })} + /> @@ -512,29 +500,17 @@ class BottomBar extends Component { onClick={this.handleClickOpenProfile} sx={{ margin: 0, bottom: 17, right: 8 }} > - 0) & !this.state.profileShown ? '' : null + 0) & !this.props.profileShown + ? 'primary' + : undefined } - color='primary' - > - this.props.setAppState({ avatarLoaded: true }), - }} - src={ - this.props.nickname - ? window.location.origin + - '/static/assets/avatars/' + - this.props.nickname + - '.png' - : null - } - /> - + nickname={this.props.nickname} + onLoad={() => this.props.setAppState({ avatarLoaded: true })} + /> diff --git a/frontend/src/components/Charts/DepthChart/index.tsx b/frontend/src/components/Charts/DepthChart/index.tsx index 0f7875dc..9c4c45da 100644 --- a/frontend/src/components/Charts/DepthChart/index.tsx +++ b/frontend/src/components/Charts/DepthChart/index.tsx @@ -216,6 +216,17 @@ const DepthChart: React.FC = ({ /> ); + const statusBadgeColor = (status: string) => { + if (status === 'Active') { + return 'success'; + } + if (status === 'Seen recently') { + return 'warning'; + } + + return 'error'; + }; + const generateTooltip: React.FunctionComponent = ( pointTooltip: PointTooltipProps, ) => { @@ -225,7 +236,12 @@ const DepthChart: React.FC = ({ - + diff --git a/frontend/src/components/Dialogs/Profile.tsx b/frontend/src/components/Dialogs/Profile.tsx index 3c62d220..0d75dd07 100644 --- a/frontend/src/components/Dialogs/Profile.tsx +++ b/frontend/src/components/Dialogs/Profile.tsx @@ -39,6 +39,7 @@ import { UserNinjaIcon, BitcoinIcon } from '../Icons'; import { getCookie } from '../../utils/cookies'; import { copyToClipboard } from '../../utils/clipboard'; import { getWebln } from '../../utils/webln'; +import RobotAvatar from '../Robots/RobotAvatar'; interface Props { isOpen: boolean; @@ -167,13 +168,10 @@ const ProfileDialog = ({ - diff --git a/frontend/src/components/EncryptedChat.js b/frontend/src/components/EncryptedChat.js index 847ba046..675f49d0 100644 --- a/frontend/src/components/EncryptedChat.js +++ b/frontend/src/components/EncryptedChat.js @@ -20,6 +20,7 @@ import { getCookie } from '../utils/cookies'; import { saveAsJson } from '../utils/saveFile'; import { copyToClipboard } from '../utils/clipboard'; import { AuditPGPDialog } from './Dialogs'; +import RobotAvatar from './Robots/RobotAvatar'; // Icons import CheckIcon from '@mui/icons-material/Check'; @@ -270,23 +271,10 @@ class Chat extends Component { - - + } style={{ backgroundColor: props.cardColor }} title={ diff --git a/frontend/src/components/OrderPage.js b/frontend/src/components/OrderPage.js index e785cfc8..bd2f7804 100644 --- a/frontend/src/components/OrderPage.js +++ b/frontend/src/components/OrderPage.js @@ -55,6 +55,7 @@ import { pn } from '../utils/prettyNumbers'; import { copyToClipboard } from '../utils/clipboard'; import { getWebln } from '../utils/webln'; import { apiClient } from '../services/api'; +import RobotAvatar from './Robots/RobotAvatar'; class OrderPage extends Component { constructor(props) { @@ -667,13 +668,13 @@ class OrderPage extends Component { // Colors for the status badges statusBadgeColor(status) { - if (status == 'Active') { + if (status === 'Active') { return 'success'; } - if (status == 'Seen recently') { + if (status === 'Seen recently') { return 'warning'; } - if (status == 'Inactive') { + if (status === 'Inactive') { return 'error'; } } @@ -692,46 +693,12 @@ class OrderPage extends Component { - - - - {' '} - {!this.state.type ? ( - - ) : ( - - )} - - } - > - - - - + - {this.state.taker_nick != 'None' ? ( + {this.state.taker_nick !== 'None' ? ( <> @@ -757,50 +724,13 @@ class OrderPage extends Component { secondary={t('Order taker')} /> - - - - {' '} - {this.state.type ? ( - - ) : ( - - )} - - } - > - - - - + diff --git a/frontend/src/components/Robots/RobotAvatar/index.tsx b/frontend/src/components/Robots/RobotAvatar/index.tsx index c1031efd..597eaa04 100644 --- a/frontend/src/components/Robots/RobotAvatar/index.tsx +++ b/frontend/src/components/Robots/RobotAvatar/index.tsx @@ -1,24 +1,37 @@ import React from 'react'; -import { Badge, Tooltip } from '@mui/material'; import SmoothImage from 'react-smooth-image'; - -import Order from '../../../models/Order.model'; +import { Avatar, Badge, Tooltip } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { SendReceiveIcon } from '../../Icons'; interface DepthChartProps { - order: Order; + nickname: string; + smooth?: boolean; + style?: object; + statusColor?: 'primary' | 'secondary' | 'default' | 'error' | 'info' | 'success' | 'warning'; + orderType?: number; + tooltip?: string; + avatarClass?: string; + onLoad?: () => void; } -const RobotAvatar: React.FC = ({ order }) => { +const RobotAvatar: React.FC = ({ + nickname, + orderType, + statusColor, + tooltip, + smooth = false, + style = {}, + avatarClass = 'flippedSmallAvatar', + onLoad = () => {}, +}) => { const { t } = useTranslation(); - const avatarSrc: string = - window.location.origin + '/static/assets/avatars/' + order?.maker_nick + '.png'; + const avatarSrc: string = window.location.origin + '/static/assets/avatars/' + nickname + '.png'; const statusBadge = (
- {order?.type === 0 ? ( + {orderType === 0 ? ( = ({ order }) => {
); - const statusBadgeColor = () => { - if (!order) { - return; - } - if (order.maker_status === 'Active') { - return 'success'; - } - if (order.maker_status === 'Seen recently') { - return 'warning'; - } - if (order.maker_status === 'Inactive') { - return 'error'; + const getAvatar = () => { + if (smooth) { + return ( + + ); + } else { + return ( + + ); } }; - return order ? ( - - + const getAvatarWithBadges = () => { + let component = getAvatar(); + + if (statusColor) { + component = ( + + {component} + + ); + } + + if (orderType !== undefined) { + component = ( -
- -
+ {component}
-
+ ); + } + + return component; + }; + + return tooltip ? ( + + {getAvatarWithBadges()} ) : ( - <> + getAvatarWithBadges() ); }; diff --git a/frontend/src/components/TradeSummary.tsx b/frontend/src/components/TradeSummary.tsx index c0b5f902..558b522f 100644 --- a/frontend/src/components/TradeSummary.tsx +++ b/frontend/src/components/TradeSummary.tsx @@ -20,6 +20,7 @@ import { } from '@mui/material'; import { pn } from '../utils/prettyNumbers'; import { saveAsJson } from '../utils/saveFile'; +import RobotAvatar from './Robots/RobotAvatar'; // Icons import FlagWithProps from './FlagWithProps'; @@ -94,12 +95,7 @@ const TradeSummary = ({ > setButtonValue(0)}> - +   {t('Maker')} @@ -109,11 +105,10 @@ const TradeSummary = ({ setButtonValue(2)}> {t('Taker')}   - diff --git a/frontend/static/locales/ca.json b/frontend/static/locales/ca.json index ec43f792..0bf2a933 100644 --- a/frontend/static/locales/ca.json +++ b/frontend/static/locales/ca.json @@ -6,7 +6,7 @@ "Hide": "Amagar", "You are self-hosting RoboSats": "Estàs hostejant RoboSats", "RoboSats client is served from your own node granting you the strongest security and privacy.": "El client RoboSats és servit pel teu propi node, gaudeixes de la major seguretat i privacitat.", - + "USER GENERATION PAGE - UserGenPage.js": "Landing Page and User Generation", "Simple and Private LN P2P Exchange": "Intercanvi LN P2P Fàcil y Privat", "This is your trading avatar": "Aquest és el teu Robot de compravenda", @@ -88,7 +88,7 @@ "Google Play Gift Code": "Targeta Regal de Google Play", "Cash F2F": "Efectiu en persona", "On-Chain BTC": "On-Chain BTC", - + "BOOK PAGE - BookPage.js": "The Book Order page", "Seller": "Ven", "Buyer": "Compra", @@ -235,7 +235,7 @@ "On your own sovereign node": "Al teu propi node sobirà", "Simply refresh your Tor Browser tab (or press Ctrl+Shift+R)": "Simplement actualitzeu la pestanya del navegador Tor (o premeu Ctrl+Shift+R)", "On remotely served client via web": "Al client servit de forma remota via web", - + "ORDER PAGE - OrderPage.js": "Order details page", "Order Box": "Ordre", "Contract": "Contracte", @@ -310,7 +310,7 @@ "Payment not received, please check your WebLN wallet.": "No s'ha rebut el pagament, fes un cop d'ull a la teva wallet WebLN.", "Invoice not received, please check your WebLN wallet.": "No s'ha rebut la factura, fes un cop d'ull a la teva wallet WebLN.", "You can close now your WebLN wallet popup.": "Ara pots tancar el popup de la teva wallet WebLN.", - + "CHAT BOX - Chat.js": "Finestra del xat", "You": "Tu", "Peer": "Ell", @@ -446,7 +446,7 @@ "The invoice provided has already expired": "La factura que has entregat ja ha caducat", "Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.": "Assegura't d' EXPORTAR el registre del xat. Els administradors poden demanar-te elregistre del xat en cas de discrepàncies. És la teva responsabilitat proveir-ho.", "Invalid address": "Direcció invàlida", - "Unable to validate address, check bitcoind backend": "No ha estat possible validar l'adreça, comprovar el backend bitcoind", + "Unable to validate address, check bitcoind backend": "No ha estat possible validar l'adreça, comprovar el backend bitcoind", "Submit payout info for {{amountSats}} Sats": "Envia info per rebre {{amountSats}} Sats", "Submit a valid invoice for {{amountSats}} Satoshis.": "Envia una factura per {{amountSats}} Sats", "Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.": "Abans de deixar-te enviar {{amountFiat}} {{currencyCode}}, volem assegurar-nos que pots rebre BTC.",