Skip to content

Commit

Permalink
Merge branch 'master' into clear-search-back-page
Browse files Browse the repository at this point in the history
  • Loading branch information
MirzaHanan authored Jan 25, 2024
2 parents 656d881 + a8cb8f5 commit 4cf5f3c
Show file tree
Hide file tree
Showing 37 changed files with 1,259 additions and 55 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: Bounties, bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is. Include a screenshot or recording if you can.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Desktop (please complete the following information):**
- Browser [e.g. chrome, safari]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]

### Acceptance Criteria
- [ ] I have tested on Chrome desktop
- [ ] I have posted a screenshot or video in my PR
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Feature
about: Describe this issue template's purpose here.
title: ''
labels: Bounties
assignees: ''

---

### Context

### Design

### Acceptance Criteria
- [ ] I've tested on Chrome
- [ ] I've submitted a screenshot or recording in my pr
- [ ] I've created a unit test that

Here is an [example unit test](https://github.com/stakwork/sphinx-tribes/blob/master/frontend/app/src/helpers/__test__/helpers.spec.ts)

Here is an [example component test](https://github.com/stakwork/sphinx-tribes/blob/9310f49b3b17a51992dada932f4298eb9eba15ff/frontend/app/src/people/widgetViews/__tests__/AboutView.spec.tsx)
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Describe your changes

## Issue ticket number and link

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update


## Checklist before requesting a review
- [ ] I have performed a self-review of my code
- [ ] I have tested on Chrome and Firefox
- [ ] I have tested on a mobile device
- [ ] I have provided a screenshot or recording of changes in my PR if there were updates to the frontend
66 changes: 66 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Docker build on push
env:
DOCKER_CLI_EXPERIMENTAL: enabled

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-20.04
name: Build and push Tribes image
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Check out from Git
uses: actions/checkout@v2
- name: Test env
run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Test print env
run: |
echo $RELEASE_TAG
echo ${{ env.RELEASE_TAG }}
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Checkout project
uses: actions/checkout@v2
- name: Setup Docker buildx action
uses: crazy-max/ghaction-docker-buildx@v1
id: buildx
with:
buildx-version: latest
qemu-version: latest
- name: Show available buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Test print env
run: |
echo $RELEASE_TAG
echo ${{ env.RELEASE_TAG }}
- name: Run Docker buildx
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--tag "${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes:${{ env.RELEASE_TAG }}" \
--output "type=registry" ./
- name: Run Docker buildx
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--tag "${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes:latest" \
--output "type=registry" ./
33 changes: 33 additions & 0 deletions .github/workflows/prettierAndPackr2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: prettier and build and packr2
on:
push:
branches:
- master

jobs:
lint:
name: build
runs-on:
- ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.token }}
- uses: actions/setup-go@v3
with:
go-version: '^1.18.3'
- run: go install github.com/gobuffalo/packr/v2/packr2
- name: build and push automatic fixes
run: |
npm i --legacy-peer-deps && CI=false npm run build && cd .. && packr2
npm run prettier
git config user.name 'Github Actions'
git config user.email [email protected]
cd ..
git add ./packrd/packed-packr.go
cd app && git add .
git commit -m "[skip ci] Automatic build fixes" || echo -n
git push
17 changes: 17 additions & 0 deletions .github/workflows/prjob_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build
on:
pull_request:
branches:
- master
jobs:
build:
name: build
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn install
- name: Build
run: CI=false yarn run build

17 changes: 17 additions & 0 deletions .github/workflows/prjob_eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Eslint
on:
pull_request:
branches:
- master
jobs:
eslint:
name: eslint
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn install
- name: Eslint
run: yarn run lint

18 changes: 18 additions & 0 deletions .github/workflows/prjob_prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Prettier
on:
pull_request:
branches:
- master
jobs:

prettier:
name: prettier
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn install
- name: Prettier
run: CI=false yarn run prettier:check

16 changes: 16 additions & 0 deletions .github/workflows/prjob_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Tests
on:
pull_request:
branches:
- master
jobs:
test-jest:
name: Jest
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn install
- name: Tests
run: NODE_OPTIONS="--max_old_space_size=8192" yarn run test-jest
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Frontend Contributing Guidelines 💻

Thank you for considering contributing to our project! Here are some guidelines to ensure smooth collaboration.

### File Naming Convention 📁

- All React component files should be named in Pascal case (e.g., `MyComponent`).
- React component functions should also be named in Pascal case (e.g., `function MyComponent() {}`).
- Folders should be named in camel case (e.g., `peopleData`).
- Typescript files should follow camel case.
- Only the `index.tsx` files should be named in lowercase.

### Prettier Fixing 🛠️

- Run the following command to fix Prettier errors before submitting:
```
yarn run prettier
```

### Eslint Fixing 🚨

- Run the following command to fix ESLint issues and ensure all test cases pass:
```
yarn run eslint
```

### Getting Started 🚀

1. Fork the repository.
2. Create a new branch for your contribution:
```
git checkout -b feature/your-feature
```
3. Make your changes.
4. Commit your changes:
```
git commit -m "Add your meaningful commit message"
```
5. Push to your fork:
```
git push origin feature/your-feature
```
6. Open a pull request to the `main` branch of the original repository.

### Code Review ⚙️

All code contributions, including those with commit access, must go through a pull request and be approved by a core developer before being merged. This ensures a proper review of all the code.

## About Sphinx Bounties 💬

A Unique bounty platform that rewards in Bitcoin. Join [Sphinx Chat](https://buy.sphinx.chat/), accomplish a bounty, and start earning Bitcoin! Explore our [website](https://people.sphinx.chat) for a list of available bounties.

### Thank You ❤️

We appreciate your contribution to our project! Your efforts make a difference, and we look forward to collaborating with you.

Feel free to connect with us on our [Sphinx Community](https://people.sphinx.chat/) and follow us on [Twitter](https://twitter.com/stakwork) for updates.
53 changes: 44 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,52 @@
# build
# Sphinx Tribes 🌐

**npm run build**
![Tribes](https://github.com/stakwork/sphinx-tribes/raw/master/img/sphinx-tribes.png)

### docker build
Welcome to **sphinx-tribes** - the decentralized message broker designed for public groups in Sphinx. Empowering users to run their own **sphinx-tribes** server, this platform seamlessly routes group messages for various applications such as **sphinx-relay** nodes, apps, websites, or IoT devices.

docker build -t sphinx-tribes-frontend .
## How it Works 🚀

### docker publish
**sphinx-tribes** operates as an MQTT broker that any node can subscribe to. Message topics always consist of two parts: `{receiverPubKey}/{groupUUID}`. Only the group owner has the privilege to publish messages, and all messages from group members are required to be submitted to the owner as a Lightning keysend payment. The group `uuid` is essentially a timestamp signed by the owner.

docker tag sphinx-tribes-frontend sphinxlightning/sphinx-tribes-frontend:0.1.3
![Tribes](https://github.com/stakwork/sphinx-tribes/raw/master/img/tribes.jpg)

docker push sphinxlightning/sphinx-tribes-frontend:0.1.3
## Authentication 🔒

docker tag sphinx-tribes-frontend sphinxlightning/sphinx-tribes-frontend:latest
The authentication process is seamlessly handled by [sphinx-auth](https://github.com/stakwork/sphinx-auth).

## Running Against Sphinx-Stack 🏃

To run the **tribes** frontend locally, utilize the following ports:

- Tribes: `yarn start:tribes:docker` (localhost:23000)
- People: `yarn start:people:docker` (localhost:23007)

## Running Frontend Against people.sphinx.chat Locally 🌐

If you wish to run only the frontend, follow these steps:

1. Modify line 10 in `src/config/ModeDispatcher.tsx`:
- Change `'localhost:3000': AppMode.TRIBES` to `'localhost:3000': AppMode.COMMUNITY`

2. Modify line 27 in `src/config/ModeDispatcher.tsx`:
- Change `return hosts[host] || AppMode.TRIBES;` to `return hosts[host] || AppMode.COMMUNITY;`

3. Modify line 6 in `src/config/host.ts`:
- Change `return host;` to `return 'people-test.sphinx.chat';`

4. Open the terminal. Locate your folder and then run:

- `yarn install` to install the dependencies
- `yarn start` to run the frontend locally

## Contributing Guidelines 🤝

All code contributions, including those of people having commit access, must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code.

We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the [contribution guide](CONTRIBUTING.md).
## Community and Support 💬

Join our community on [Forum/Chat](https://people.sphinx.chat) to connect with other users and get support.

Feel free to explore the potential of **sphinx-tribes** and contribute to its vibrant ecosystem! 🌟

docker push sphinxlightning/sphinx-tribes-frontend:latest
3 changes: 2 additions & 1 deletion deploy/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
updateTribes.sh
updateTribes.sh
updateProdTribes.sh
9 changes: 9 additions & 0 deletions deploy/notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
docker build -t sphinx-tribes-frontend .

docker tag sphinx-tribes-frontend sphinxlightning/sphinx-tribes-frontend:0.1.5

docker push sphinxlightning/sphinx-tribes-frontend:0.1.5

docker tag sphinx-tribes-frontend sphinxlightning/sphinx-tribes-frontend:latest

docker push sphinxlightning/sphinx-tribes-frontend:latest
Loading

0 comments on commit 4cf5f3c

Please sign in to comment.