Skip to content

Commit

Permalink
Merge pull request #12 from Kodylow/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow authored Dec 8, 2023
2 parents e5f9048 + 977a140 commit 9d2ae6f
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 41 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/fedimint-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: fedimint-thunderhub

on:
push:
branches:
- master
tags: ['v*']

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
fedimintui/fedimint-thunderhub
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Login to Docker Hub
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
username: fedimintui
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push gateway-ui
uses: docker/build-push-action@v4
with:
file: Dockerfile
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Checkout repository content
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
uses: actions/checkout@v4

# This workflow requires the repository content to be locally available to read the README
- name: Update the Docker Hub description
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
uses: peter-evans/dockerhub-description@v3
with:
username: fedimintui
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
repository: fedimintui/fedimint-thunderhub
readme-filepath: ./README.md
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ENV BASE_PATH=${BASE_PATH}
ARG NODE_ENV="production"
ENV NODE_ENV=${NODE_ENV}
ENV NEXT_TELEMETRY_DISABLED=1
ARG FM_GATEWAY_API=""
ENV FM_GATEWAY_API=${FM_GATEWAY_API}
ARG FM_GATEWAY_PASSWORD=""
ENV FM_GATEWAY_PASSWORD=${FM_GATEWAY_PASSWORD}

# Build the NestJS and NextJS application
COPY . .
Expand All @@ -51,6 +55,10 @@ ENV BASE_PATH=${BASE_PATH}
ARG NODE_ENV="production"
ENV NODE_ENV=${NODE_ENV}
ENV NEXT_TELEMETRY_DISABLED=1
ARG FM_GATEWAY_API=""
ENV FM_GATEWAY_API=${FM_GATEWAY_API}
ARG FM_GATEWAY_PASSWORD=""
ENV FM_GATEWAY_PASSWORD=${FM_GATEWAY_PASSWORD}

COPY --from=build /app/package.json ./
COPY --from=build /app/node_modules/ ./node_modules
Expand Down
7 changes: 4 additions & 3 deletions flake.lock

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

5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
fedimint = { url = "github:fedimint/fedimint?branch=releases/0.2"; };
fedimint = {
url =
"github:fedimint/fedimint?rev=24113a64b270bf2ecb49b8f4554ba975025711db";
};
};
outputs = { self, nixpkgs, flake-utils, fedimint }:
flake-utils.lib.eachDefaultSystem (system:
Expand Down
1 change: 0 additions & 1 deletion src/client/pages/fedimints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const FedimintsView = () => {
display: 'flex',
whiteSpace: 'nowrap',
cursor: 'pointer',
justifyContent: 'center',
}}
onClick={() => {
if (props.row.original.balance_msat > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/components/chart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const BarChart = ({
const dates = data.map((d: any) => d.date);

return { dates, series };
}, [data, title]);
}, [data, title, dataKey]);

const option = useMemo(() => {
const fontColor = themeContext.mode === 'light' ? 'black' : 'white';
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/components/chart/HorizontalBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const HorizontalBarChart = ({
legend: { show: true },
series: seriesData,
};
}, [colorRange, themeContext, seriesData, yLabels]);
}, [colorRange, themeContext, seriesData, yLabels, maxValue]);

if (!keys.length) return null;

Expand Down
2 changes: 1 addition & 1 deletion src/client/src/components/table/DebouncedInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function DebouncedInput({
}, debounce);

return () => clearTimeout(timeout);
}, [value]);
}, [value, debounce, onChange]);

return (
<Input
Expand Down
4 changes: 2 additions & 2 deletions src/client/src/utils/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ export const saveToPc = (
link.download = isCsv
? `${filename}.csv`
: isJson
? `${filename}.json`
: `${filename}.txt`;
? `${filename}.json`
: `${filename}.txt`;
link.href = url;
link.click();
};
Expand Down
65 changes: 36 additions & 29 deletions src/client/src/views/home/account/AccountButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ import { ReceiveOnChainCard } from './receiveOnChain/ReceiveOnChain';
import { SendOnChainCard } from './sendOnChain/SendOnChain';
import { PegInEcashCard } from './pegInEcash/PegInEcash';
import { PegOutEcashCard } from './pegOutEcash/PegOutEcash';
import { useGatewayState } from '../../../context/GatewayContext';

const SECTION_COLOR = '#FFD300';

const S = {
grid: styled.div`
grid: styled.div<{ federations: number }>`
display: grid;
grid-gap: 8px;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
grid-template-columns: ${({ federations }) =>
federations > 0 ? '1fr 1fr 1fr 1fr 1fr 1fr' : '1fr 1fr 1fr 1fr'};
margin-bottom: 32px;
@media (${mediaWidths.modifiedMobile}) {
Expand All @@ -28,6 +30,7 @@ const S = {

export const AccountButtons = () => {
const [state, setState] = useState<string>('none');
const { gatewayInfo } = useGatewayState();

const renderContent = () => {
switch (state) {
Expand All @@ -50,7 +53,7 @@ export const AccountButtons = () => {

return (
<>
<S.grid>
<S.grid federations={gatewayInfo?.federations.length || 0}>
<ColorButton
withBorder={state === 'send_ln'}
onClick={() => setState(state === 'send_ln' ? 'none' : 'send_ln')}
Expand Down Expand Up @@ -101,32 +104,36 @@ export const AccountButtons = () => {
)}
Receive
</ColorButton>
<ColorButton
withBorder={state === 'pegout_ecash'}
onClick={() =>
setState(state === 'pegout_ecash' ? 'none' : 'pegout_ecash')
}
>
{state === 'pegout_ecash' ? (
<X size={18} color={SECTION_COLOR} />
) : (
<Sun size={18} color={SECTION_COLOR} />
)}
Peg Out
</ColorButton>
<ColorButton
withBorder={state === 'pegin_ecash'}
onClick={() =>
setState(state === 'pegin_ecash' ? 'none' : 'pegin_ecash')
}
>
{state === 'pegin_ecash' ? (
<X size={18} color={SECTION_COLOR} />
) : (
<Sun size={18} color={SECTION_COLOR} />
)}
Peg In
</ColorButton>
{gatewayInfo?.federations && gatewayInfo?.federations.length > 0 && (
<ColorButton
withBorder={state === 'pegout_ecash'}
onClick={() =>
setState(state === 'pegout_ecash' ? 'none' : 'pegout_ecash')
}
>
{state === 'pegout_ecash' ? (
<X size={18} color={SECTION_COLOR} />
) : (
<Sun size={18} color={SECTION_COLOR} />
)}
Peg Out
</ColorButton>
)}
{gatewayInfo?.federations && gatewayInfo?.federations.length > 0 && (
<ColorButton
withBorder={state === 'pegin_ecash'}
onClick={() =>
setState(state === 'pegin_ecash' ? 'none' : 'pegin_ecash')
}
>
{state === 'pegin_ecash' ? (
<X size={18} color={SECTION_COLOR} />
) : (
<Sun size={18} color={SECTION_COLOR} />
)}
Peg In
</ColorButton>
)}
</S.grid>
{state !== 'none' && <Card>{renderContent()}</Card>}
</>
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/views/home/account/AccountInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const AccountInfo = () => {
<>
<CardWithTitle>
<SubTitle>
Network: {getNetworkIndicator(gatewayInfo?.network || 'bitcoin')}
Network: {getNetworkIndicator(gatewayInfo?.network || 'unknown')}
</SubTitle>
{/* <Card>
<ResponsiveLine>
Expand Down
1 change: 0 additions & 1 deletion src/client/src/views/home/account/network.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react';
export const getNetworkIndicator = (network: string) => {
let color: string;
let name: string;

switch (network) {
case 'bitcoin':
color = 'orange';
Expand Down

0 comments on commit 9d2ae6f

Please sign in to comment.