mirror of
https://github.com/AtHeartEngineering/bandada.git
synced 2026-01-09 18:18:19 -05:00
Merge branch 'main' into chore/merge-main-dev
This commit is contained in:
36
.github/scripts/cloud-init.sh
vendored
Executable file
36
.github/scripts/cloud-init.sh
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
trap 'poweroff' TERM EXIT INT
|
||||
|
||||
Repo=$(curl http://169.254.169.254/latest/meta-data/tags/instance/Repo)
|
||||
Branch=$(curl http://169.254.169.254/latest/meta-data/tags/instance/Branch)
|
||||
|
||||
Local_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)
|
||||
|
||||
# Install pkgs
|
||||
apt-get update
|
||||
apt-get install -y net-tools
|
||||
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
echo \
|
||||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
|
||||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
|
||||
tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
apt-get update
|
||||
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
usermod -aG docker ubuntu
|
||||
|
||||
su -P ubuntu -c "git clone -b $Branch --single-branch https://github.com/ntampakas/$Repo.git /home/ubuntu/$Repo"
|
||||
su -P ubuntu -c "cp /home/ubuntu/$Repo/apps/api/.env.example /home/ubuntu/$Repo/apps/api/.env"
|
||||
su -P ubuntu -c "sed -i 's/\(DB_TYPE=\).*/\1postgres/' /home/ubuntu/$Repo/apps/api/.env"
|
||||
su -P ubuntu -c "sed -i 's/\(DB_URL=\).*/\1postgres:\/\/root:helloworld\@postgres:5432\/bandada/' /home/ubuntu/$Repo/apps/api/.env"
|
||||
|
||||
su -P ubuntu -c "rm /home/ubuntu/$Repo/apps/{client,dashboard}/.env.production /home/ubuntu/$Repo/apps/{client,dashboard}/.env.staging"
|
||||
su -P ubuntu -c "sed -i 's/localhost/$Local_IP/g' /home/ubuntu/$Repo/apps/{client,dashboard}/.env.local"
|
||||
|
||||
su -P ubuntu -c "cd /home/ubuntu/$Repo ; docker compose up -d"
|
||||
|
||||
sleep 6h
|
||||
16
.github/scripts/get_ip.sh
vendored
Executable file
16
.github/scripts/get_ip.sh
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
TRIGGER=$1
|
||||
ACTOR=$2
|
||||
VPC="vpc-07d12b28fd72d152e"
|
||||
|
||||
# Stop here in schedule
|
||||
[ ! $TRIGGER = "maintenance" ] || exit 0
|
||||
|
||||
sleep 10
|
||||
|
||||
EC2_IP=$(aws ec2 describe-instances --filters "Name=instance-state-name,Values=[running]" "Name=tag:Name,Values='bandada-ephemeral-$ACTOR-*'" "Name=network-interface.vpc-id,Values=[$VPC]" --query "Reservations[*].Instances[*].[NetworkInterfaces[*].[PrivateIpAddress]]" --output text)
|
||||
|
||||
echo "URL: http://$EC2_IP:3001"
|
||||
47
.github/scripts/run.sh
vendored
Executable file
47
.github/scripts/run.sh
vendored
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
TRIGGER=$1
|
||||
BRANCH=$2
|
||||
ACTOR=$3
|
||||
SHA=$4
|
||||
AMI="ami-04e601abe3e1a910f"
|
||||
SG="sg-04d8c2eb4beca2de9"
|
||||
SUBNET="subnet-066cf21c696ef55c8"
|
||||
VPC="vpc-07d12b28fd72d152e"
|
||||
|
||||
# Kill old instances
|
||||
CURRENT_TIME_EPOCH=$(date -d `date -Is` +"%s")
|
||||
EC2=$(aws ec2 describe-instances --filters "Name=instance-state-name,Values=[running]" "Name=tag:Name,Values='bandada-ephemeral-*'" "Name=network-interface.vpc-id,Values=[$VPC]" --query "Reservations[*].Instances[*].InstanceId" --output text)
|
||||
for i in $EC2; do
|
||||
EC2_LAUNCH_TIME=$(aws ec2 describe-instances --instance-ids $i --query 'Reservations[*].Instances[*].LaunchTime' --output text)
|
||||
LAUNCH_TIME_EPOCH=$(date -d $EC2_LAUNCH_TIME +"%s")
|
||||
diff=$(expr $CURRENT_TIME_EPOCH - $LAUNCH_TIME_EPOCH)
|
||||
|
||||
if [ $diff -gt 21600 ]; then
|
||||
aws ec2 terminate-instances --instance-ids $i
|
||||
fi
|
||||
done
|
||||
|
||||
# Stop here in schedule
|
||||
[ ! $TRIGGER = "maintenance" ] || exit 0
|
||||
|
||||
# Check if actor ec2 exists
|
||||
ACTOR_EC2=$(aws ec2 describe-instances --filters "Name=instance-state-name,Values=[running]" "Name=tag:Name,Values='bandada-ephemeral-$ACTOR-*'" "Name=network-interface.vpc-id,Values=[$VPC]" --query "Reservations[*].Instances[*].InstanceId" --output text)
|
||||
|
||||
[ -z $ACTOR_EC2 ] || aws ec2 terminate-instances --instance-ids $ACTOR_EC2
|
||||
|
||||
# Launch new instance
|
||||
aws ec2 run-instances \
|
||||
--user-data "file://.github/scripts/cloud-init.sh" \
|
||||
--image-id $AMI \
|
||||
--count 1 \
|
||||
--instance-type t3a.large \
|
||||
--key-name bandada \
|
||||
--security-group-ids $SG \
|
||||
--subnet-id $SUBNET \
|
||||
--block-device-mappings "[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"VolumeSize\":32,\"DeleteOnTermination\":true}}]" \
|
||||
--instance-initiated-shutdown-behavior terminate \
|
||||
--tag-specification "ResourceType=instance,Tags=[{Key=Name,Value="bandada-ephemeral-$ACTOR-$SHA"},{Key=Repo,Value="bandada"},{Key=Branch,Value="$BRANCH"}]" \
|
||||
--metadata-options "InstanceMetadataTags=enabled"
|
||||
30
.github/workflows/coverall.yml
vendored
30
.github/workflows/coverall.yml
vendored
@@ -5,9 +5,6 @@ on:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
DEFAULT_NETWORK: localhost
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -18,37 +15,22 @@ jobs:
|
||||
- contracts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "yarn"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
|
||||
- name: Restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Build monorepo
|
||||
run: yarn
|
||||
|
||||
- name: Build libraries
|
||||
run: yarn workspaces foreach --no-private run build
|
||||
|
||||
- name: Test code
|
||||
run: yarn test:${{ matrix.tests }}:coverage
|
||||
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
uses: coverallsapp/github-action@v2
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
flag-name: run-${{ matrix.tests }}
|
||||
@@ -60,7 +42,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Coveralls Finished
|
||||
uses: coverallsapp/github-action@master
|
||||
uses: coverallsapp/github-action@v2
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
parallel-finished: true
|
||||
|
||||
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@@ -60,7 +60,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
48
.github/workflows/ephemeral.yml
vendored
Normal file
48
.github/workflows/ephemeral.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Ephemeral
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 */6 * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
action:
|
||||
description: "Action"
|
||||
required: true
|
||||
default: "spawn"
|
||||
type: choice
|
||||
options:
|
||||
- spawn
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
timeout-minutes: 5
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DATA: ${{ github.event.inputs.action || 'maintenance' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::490752553772:role/bandada-ephemeral-deploy-slc
|
||||
role-duration-seconds: 900
|
||||
aws-region: eu-central-1
|
||||
|
||||
- name: Launch instance
|
||||
run: |
|
||||
.github/scripts/run.sh ${{ env.DATA }} $GITHUB_REF_NAME $GITHUB_TRIGGERING_ACTOR $GITHUB_SHA
|
||||
|
||||
- name: Instance IP
|
||||
run: |
|
||||
.github/scripts/get_ip.sh ${{ env.DATA }} $GITHUB_TRIGGERING_ACTOR
|
||||
2
.github/workflows/postgres.yml
vendored
2
.github/workflows/postgres.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
22
.github/workflows/release.yml
vendored
22
.github/workflows/release.yml
vendored
@@ -13,29 +13,19 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "yarn"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
|
||||
- name: Restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Build monorepo
|
||||
run: yarn
|
||||
|
||||
- run: yarn version:release
|
||||
|
||||
23
.github/workflows/style.yml
vendored
23
.github/workflows/style.yml
vendored
@@ -11,32 +11,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "yarn"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
|
||||
- name: Restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Build monorepo
|
||||
run: yarn
|
||||
|
||||
- name: Build
|
||||
run: yarn build
|
||||
|
||||
- name: Run Prettier
|
||||
run: yarn prettier
|
||||
|
||||
|
||||
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
@@ -6,39 +6,21 @@ on:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
DEFAULT_NETWORK: localhost
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "yarn"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
|
||||
- name: Restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Build monorepo
|
||||
run: yarn
|
||||
|
||||
- name: Build libraries
|
||||
run: yarn workspaces foreach --no-private run build
|
||||
|
||||
- name: Test code
|
||||
run: yarn test
|
||||
|
||||
@@ -170,7 +170,7 @@ Please see the latest [documentation](https://pse-team.notion.site/Bandada-82d0d
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
### Prerequisities
|
||||
### Prerequisites
|
||||
|
||||
- [NodeJS](https://nodejs.org/en) >= v18.17.0
|
||||
|
||||
@@ -236,7 +236,7 @@ yarn test
|
||||
|
||||
## 🐳 Running in Docker
|
||||
|
||||
### Prerequisities
|
||||
### Prerequisites
|
||||
|
||||
- [Docker](https://www.docker.com/) >= 4.26.1
|
||||
- [docker-compose](https://docs.docker.com/compose/) >= 2.24.2
|
||||
|
||||
@@ -57,7 +57,70 @@ async function bootstrap() {
|
||||
"https://raw.githubusercontent.com/privacy-scaling-explorations/bandada/main/apps/dashboard/src/assets/favicon.ico",
|
||||
customSiteTitle: "Bandada API Docs",
|
||||
customCss: `.topbar-wrapper img {content:url('https://raw.githubusercontent.com/privacy-scaling-explorations/bandada/d5268274cbb93f73a1960e131bff0d2bf1eacea9/apps/dashboard/src/assets/icon1.svg'); width:60px; height:auto;}
|
||||
.swagger-ui .topbar { background-color: transparent; } small.version-stamp { display: none !important; }`
|
||||
.swagger-ui .topbar { background-color: transparent; } small.version-stamp { display: none !important; }`,
|
||||
customJsStr: `
|
||||
// Add a custom title to the right side of the Swagger UI page
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const customTitle = document.createElement('div');
|
||||
customTitle.style.position = 'absolute';
|
||||
customTitle.style.top = '27px';
|
||||
customTitle.style.padding = '10px';
|
||||
customTitle.style.color = 'black';
|
||||
customTitle.style.fontSize = '18px';
|
||||
customTitle.style.padding = '0 20px';
|
||||
customTitle.style.maxWidth = '1460px';
|
||||
customTitle.style.display = 'flex';
|
||||
customTitle.style.justifyContent = 'end';
|
||||
customTitle.style.width = '100%';
|
||||
|
||||
|
||||
// Create a hyperlink element
|
||||
const link = document.createElement('a');
|
||||
link.href = 'https://github.com/privacy-scaling-explorations/bandada';
|
||||
link.rel = 'noreferrer noopener nofollow';
|
||||
link.target = '_blank'
|
||||
link.style.color = 'grey';
|
||||
link.style.display = 'flex';
|
||||
|
||||
// Create a text node for the link text
|
||||
const linkText = document.createTextNode('Github');
|
||||
|
||||
// Append the text node to the link
|
||||
link.appendChild(linkText);
|
||||
|
||||
// Create an SVG element for the GitHub icon
|
||||
const githubIcon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||
githubIcon.setAttribute('width', '24');
|
||||
githubIcon.setAttribute('height', '24');
|
||||
githubIcon.setAttribute('viewBox', '0 0 20 20');
|
||||
githubIcon.setAttribute('fill', 'currentColor');
|
||||
|
||||
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
||||
path.setAttribute('d', 'M8 .153C3.589.153 0 3.742 0 8.153c0 3.436 2.223 6.358 5.307 7.408.387.071.53-.168.53-.374 0-.185-.007-.674-.01-1.322-2.039.445-2.47-.979-2.47-.979-.334-.849-.815-1.075-.815-1.075-.667-.457.05-.448.05-.448.739.052 1.13.76 1.13.76.656 1.124 1.719.799 2.134.61.067-.478.256-.8.466-.98-1.63-.184-3.34-.815-3.34-3.627 0-.8.287-1.457.754-1.969-.076-.185-.327-.932.072-1.943 0 0 .618-.198 2.03.752a6.74 6.74 0 0 1 1.8-.245c.61.003 1.226.082 1.8.245 1.41-.95 2.027-.752 2.027-.752.4 1.011.148 1.758.073 1.943.47.512.754 1.17.754 1.969 0 2.82-1.712 3.44-3.35 3.623.264.227.497.672.497 1.356 0 .977-.009 1.764-.009 2.004 0 .207.141.449.544.373C13.775 14.511 16 11.59 16 8.154 16 3.743 12.411 .154 8 .154z');
|
||||
|
||||
// Append the path to the GitHub icon
|
||||
githubIcon.appendChild(path);
|
||||
|
||||
// Append the GitHub icon to the link
|
||||
link.insertBefore(githubIcon, link.firstChild);
|
||||
|
||||
// Apply some padding to create space between the icon and the text
|
||||
link.style.paddingLeft = '8px';
|
||||
|
||||
// Append the link to the custom title
|
||||
customTitle.appendChild(link);
|
||||
|
||||
const parentDiv = document.createElement('div');
|
||||
parentDiv.style.display = 'flex';
|
||||
parentDiv.style.justifyContent = 'center';
|
||||
parentDiv.style.width = 'auto';
|
||||
|
||||
|
||||
parentDiv.appendChild(customTitle)
|
||||
|
||||
document.body.appendChild(parentDiv);
|
||||
});
|
||||
`
|
||||
}
|
||||
|
||||
SwaggerModule.setup("/", app, document, configUI)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://pse.dev/discord">
|
||||
<a href="https://discord.com/invite/sF5CT5rzrR">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -57,6 +57,13 @@ export default function GroupPage(): JSX.Element {
|
||||
const [_removeGroupName, setRemoveGroupName] = useState<string>("")
|
||||
const [_selectedMembers, setSelectedMembers] = useState<string[]>([])
|
||||
const { admin } = useContext(AuthContext)
|
||||
const isGroupAdmin = !!(
|
||||
admin &&
|
||||
_group &&
|
||||
(groupType === "off-chain"
|
||||
? _group.admin === admin.id
|
||||
: _group.admin === admin.address.toLowerCase())
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
;(async () => {
|
||||
@@ -391,82 +398,87 @@ ${memberIds.join("\n")}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
{groupType === "off-chain" && !_group.credentials && (
|
||||
<Box
|
||||
bgColor="balticSea.50"
|
||||
p="25px 30px 25px 30px"
|
||||
borderRadius="8px"
|
||||
>
|
||||
<HStack justify="space-between">
|
||||
<Text fontSize="20px">Use API key</Text>
|
||||
{groupType === "off-chain" &&
|
||||
!_group.credentials &&
|
||||
isGroupAdmin && (
|
||||
<Box
|
||||
bgColor="balticSea.50"
|
||||
p="25px 30px 25px 30px"
|
||||
borderRadius="8px"
|
||||
>
|
||||
<HStack justify="space-between">
|
||||
<Text fontSize="20px">Use API key</Text>
|
||||
|
||||
<Switch
|
||||
id="enable-api"
|
||||
isChecked={_group.apiEnabled}
|
||||
onChange={(event) =>
|
||||
onApiAccessToggle(event.target.checked)
|
||||
}
|
||||
/>
|
||||
</HStack>
|
||||
<Switch
|
||||
id="enable-api"
|
||||
isChecked={_group.apiEnabled}
|
||||
onChange={(event) =>
|
||||
onApiAccessToggle(
|
||||
event.target.checked
|
||||
)
|
||||
}
|
||||
/>
|
||||
</HStack>
|
||||
|
||||
<Text mt="10px" color="balticSea.700">
|
||||
Connect your app to your group using an API key.
|
||||
</Text>
|
||||
<Text mt="10px" color="balticSea.700">
|
||||
Connect your app to your group using an API
|
||||
key.
|
||||
</Text>
|
||||
|
||||
{_group.apiEnabled && (
|
||||
<>
|
||||
<InputGroup size="lg" mt="10px">
|
||||
<Input
|
||||
pr="50px"
|
||||
placeholder="API key"
|
||||
value={_group?.apiKey}
|
||||
isDisabled
|
||||
/>
|
||||
{_group.apiEnabled && (
|
||||
<>
|
||||
<InputGroup size="lg" mt="10px">
|
||||
<Input
|
||||
pr="50px"
|
||||
placeholder="API key"
|
||||
value={_group?.apiKey}
|
||||
isDisabled
|
||||
/>
|
||||
|
||||
<InputRightElement mr="5px">
|
||||
<Tooltip
|
||||
label={
|
||||
hasCopied
|
||||
? "Copied!"
|
||||
: "Copy"
|
||||
}
|
||||
closeOnClick={false}
|
||||
hasArrow
|
||||
>
|
||||
<IconButton
|
||||
variant="link"
|
||||
aria-label="Copy API key"
|
||||
onClick={onCopy}
|
||||
onMouseDown={(e) =>
|
||||
e.preventDefault()
|
||||
<InputRightElement mr="5px">
|
||||
<Tooltip
|
||||
label={
|
||||
hasCopied
|
||||
? "Copied!"
|
||||
: "Copy"
|
||||
}
|
||||
icon={
|
||||
<Icon
|
||||
color="sunsetOrange.600"
|
||||
boxSize="5"
|
||||
as={FiCopy}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</InputRightElement>
|
||||
</InputGroup>
|
||||
closeOnClick={false}
|
||||
hasArrow
|
||||
>
|
||||
<IconButton
|
||||
variant="link"
|
||||
aria-label="Copy API key"
|
||||
onClick={onCopy}
|
||||
onMouseDown={(e) =>
|
||||
e.preventDefault()
|
||||
}
|
||||
icon={
|
||||
<Icon
|
||||
color="sunsetOrange.600"
|
||||
boxSize="5"
|
||||
as={FiCopy}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</Tooltip>
|
||||
</InputRightElement>
|
||||
</InputGroup>
|
||||
|
||||
<Button
|
||||
mt="10px"
|
||||
variant="link"
|
||||
color="balticSea.600"
|
||||
textDecoration="underline"
|
||||
onClick={generateApiKey}
|
||||
>
|
||||
Generate new key
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
<Button
|
||||
mt="10px"
|
||||
variant="link"
|
||||
color="balticSea.600"
|
||||
textDecoration="underline"
|
||||
onClick={generateApiKey}
|
||||
>
|
||||
Generate new key
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
<Image src={image1} />
|
||||
{_group.type === "off-chain" && (
|
||||
{_group.type === "off-chain" && isGroupAdmin && (
|
||||
<Box
|
||||
bgColor="classicRose.50"
|
||||
p="25px 30px 25px 30px"
|
||||
@@ -524,13 +536,7 @@ ${memberIds.join("\n")}
|
||||
variant="solid"
|
||||
colorScheme="secondary"
|
||||
onClick={addMembersModal.onOpen}
|
||||
hidden={
|
||||
!admin ||
|
||||
(groupType === "off-chain"
|
||||
? _group.admin !== admin.id
|
||||
: _group.admin !==
|
||||
admin.address.toLowerCase())
|
||||
}
|
||||
hidden={!isGroupAdmin}
|
||||
>
|
||||
Add member
|
||||
</Button>
|
||||
@@ -579,18 +585,19 @@ ${memberIds.join("\n")}
|
||||
>
|
||||
<HStack justify="space-between" w="100%">
|
||||
<HStack>
|
||||
{_group.type === "off-chain" && (
|
||||
<Checkbox
|
||||
isChecked={_selectedMembers.includes(
|
||||
memberId
|
||||
)}
|
||||
onChange={() =>
|
||||
toggleMemberSelection(
|
||||
{_group.type === "off-chain" &&
|
||||
isGroupAdmin && (
|
||||
<Checkbox
|
||||
isChecked={_selectedMembers.includes(
|
||||
memberId
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
)}
|
||||
onChange={() =>
|
||||
toggleMemberSelection(
|
||||
memberId
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<Icon
|
||||
color="balticSea.300"
|
||||
boxSize="6"
|
||||
@@ -604,44 +611,51 @@ ${memberIds.join("\n")}
|
||||
</Text>
|
||||
</HStack>
|
||||
|
||||
{_group.type === "off-chain" && (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
as={IconButton}
|
||||
aria-label="Options"
|
||||
icon={
|
||||
<Icon
|
||||
color="balticSea.300"
|
||||
boxSize="6"
|
||||
as={MdOutlineMoreVert}
|
||||
/>
|
||||
}
|
||||
variant="link"
|
||||
/>
|
||||
<MenuList>
|
||||
<MenuItem
|
||||
{_group.type === "off-chain" &&
|
||||
isGroupAdmin && (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
as={IconButton}
|
||||
aria-label="Options"
|
||||
icon={
|
||||
<Icon
|
||||
mt="5px"
|
||||
color="balticSea.300"
|
||||
boxSize="6"
|
||||
as={MdOutlineCancel}
|
||||
as={
|
||||
MdOutlineMoreVert
|
||||
}
|
||||
/>
|
||||
}
|
||||
onClick={() =>
|
||||
removeMember(memberId)
|
||||
}
|
||||
>
|
||||
Remove
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
)}
|
||||
variant="link"
|
||||
/>
|
||||
<MenuList>
|
||||
<MenuItem
|
||||
icon={
|
||||
<Icon
|
||||
mt="5px"
|
||||
color="balticSea.300"
|
||||
boxSize="6"
|
||||
as={
|
||||
MdOutlineCancel
|
||||
}
|
||||
/>
|
||||
}
|
||||
onClick={() =>
|
||||
removeMember(
|
||||
memberId
|
||||
)
|
||||
}
|
||||
>
|
||||
Remove
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
)}
|
||||
</HStack>
|
||||
</Flex>
|
||||
))
|
||||
)}
|
||||
{_group.type === "off-chain" && (
|
||||
{_group.type === "off-chain" && isGroupAdmin && (
|
||||
<Flex mt="20px" justify="space-between" align="center">
|
||||
<ButtonGroup>
|
||||
<Button
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://pse.dev/discord">
|
||||
<a href="https://discord.com/invite/sF5CT5rzrR">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class ApiSdk {
|
||||
/**
|
||||
* Initializes the ApiSdk object with a Supported URL or custom URL.
|
||||
* @param url Supported URL or custom URL.
|
||||
* @param config Request config.
|
||||
* @param config [Axios](https://axios-http.com/docs/req_config) Request Config.
|
||||
*/
|
||||
constructor(url: SupportedUrl | string = SupportedUrl.PROD, config?: any) {
|
||||
checkParameter(url, "url", "string")
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://pse.dev/discord">
|
||||
<a href="https://discord.com/invite/sF5CT5rzrR">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://pse.dev/discord">
|
||||
<a href="https://discord.com/invite/sF5CT5rzrR">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
🔎 Issues
|
||||
</a>
|
||||
<span> | </span>
|
||||
<a href="https://pse.dev/discord">
|
||||
<a href="https://discord.com/invite/sF5CT5rzrR">
|
||||
🗣️ Chat & Support
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
Reference in New Issue
Block a user