From 78edae2785a4b355c9f356d6cb5823d29165ea6e Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Wed, 21 May 2025 12:38:54 -0400 Subject: [PATCH] feat/routes (#9) * refactor: decouple core logic from global configuration * fix: apply consistent error handling across application * refactor: improve component rendering for better performance * feat: migrate views to use directory for components * feat: streamline UI imports and package structure * feat: update templ version to v0.3.865 * feat: enhance application observability with status check * refactor: decouple database setup from command line tools * refactor: replace card component with styled divs for improved customization * refactor: rename and move Helia console components to blocks * chore: reorganize controllers under handlers * feat: implement home page UI with registration form * * fix: correct file path in templ error messages * refactor: use web component for connection status indicator * feat: enhance connection status indicator with visual cue * chore: move Helia initialization script to helia package * refactor: rename 'appComponent' to 'consoleComponent' * chore: standardize import paths across vault package * feat: introduce common error definitions for API responses * refactor: centralize handle input logic into reusable component * style: adjust user handle input for better visual feedback * build: update templ generated files * feat: automate builds, archives, and releases * ci: consolidate publishing workflows for improved automation * ci: simplify deployment workflows and leverage Cloudflare * ci: allow manual deployment initiation * ci: add trigger for deploy workflow * docs: Update README with new development workflow and component details --- .github/workflows/cd.yml | 67 ----- .github/workflows/check-pr.yml | 138 ----------- .github/workflows/deploy.yml | 30 +++ .github/workflows/new-release.yml | 66 ----- .github/workflows/new-tag.yml | 51 ---- .github/workflows/post-merge.yml | 33 --- .github/workflows/release.yml | 31 +++ .goreleaser.yaml | 43 ++++ README.md | 118 +++++---- Taskfile.yml | 4 + cmd/front/main.go | 2 +- cmd/vault/main.go | 2 +- components/inputs/input_handle.templ | 33 --- components/views/console.templ | 91 ------- components/views/home.templ | 48 ---- components/views/login.templ | 25 -- components/views/register.templ | 28 --- .../account/card.templ | 0 .../account/card_templ.go | 12 +- .../account/entity.go | 0 .../account/list.templ | 0 .../account/list_templ.go | 0 .../account/queries.go | 0 .../account/select.templ | 0 .../account/select_templ.go | 0 .../activity/card.templ | 0 .../activity/card_templ.go | 12 +- .../activity/entity.go | 0 .../activity/list.templ | 0 .../activity/list_templ.go | 0 .../activity/queries.go | 0 .../asset/entity.go | 0 .../asset/queries.go | 0 .../asset/select.templ | 0 .../asset/select_templ.go | 0 .../blockchain/entity.go | 0 .../blockchain/queries.go | 0 .../credential/descriptor.go | 0 .../credential/entity.go | 0 .../credential/inputs.templ | 0 .../credential/inputs_templ.go | 0 .../credential/queries.go | 0 .../health/entity.go | 0 .../health/queries.go | 0 .../prices/entity.go | 0 .../prices/queries.go | 0 .../profile/entity.go | 0 .../profile/inputs.templ | 0 .../profile/inputs_templ.go | 0 .../profile/queries.go | 0 .../service/entity.go | 0 .../service/queries.go | 0 .../vault/entity.go | 0 .../vault/forms.templ | 0 .../vault/forms_templ.go | 0 .../vault/options.go | 2 +- .../vault/queries.go | 0 .../{default_expired.go => default_error.go} | 4 +- handlers/default_index.go | 2 +- handlers/default_valid.go | 2 +- handlers/login_check.go | 2 +- handlers/login_finish.go | 2 +- handlers/login_initial.go | 2 +- handlers/login_start.go | 2 +- handlers/register_check.go | 2 +- handlers/register_finish.go | 2 +- handlers/register_initial.go | 2 +- handlers/register_start.go | 2 +- handlers/status_check.go | 38 +++ middleware/cache.go | 2 +- middleware/context.go | 2 +- middleware/middleware.go | 2 +- routes/routes.go | 7 +- sink/base/errors.go | 10 + {config => sink/config}/config.go | 0 {config => sink/config}/errors.go | 0 {config => sink/config}/server.go | 0 {cmd/vault => sink/migrations}/query.sql | 0 {cmd/vault => sink/migrations}/schema.sql | 0 sqlc.yaml | 6 +- .../app/helia/blocks.templ | 14 +- .../app/helia/blocks_templ.go | 14 +- ui/app/helia/script.templ | 49 ++++ ui/app/helia/script_templ.go | 60 +++++ {components => ui}/charts/area_chart.templ | 0 {components => ui}/charts/area_chart_templ.go | 4 +- {components => ui}/charts/bar_chart.templ | 0 {components => ui}/charts/bar_chart_templ.go | 4 +- {components => ui}/charts/candle_chart.templ | 0 .../charts/candle_chart_templ.go | 0 {components => ui}/charts/line_chart.templ | 0 {components => ui}/charts/line_chart_templ.go | 4 +- {components => ui}/charts/pie_chart.templ | 0 {components => ui}/charts/pie_chart_templ.go | 4 +- {components => ui}/inputs/input_avatar.templ | 0 .../inputs/input_avatar_templ.go | 0 {components => ui}/inputs/input_bio.templ | 0 {components => ui}/inputs/input_bio_templ.go | 4 +- ui/inputs/input_handle.templ | 34 +++ .../inputs/input_handle_templ.go | 12 +- {components => ui}/inputs/input_passkey.templ | 0 .../inputs/input_passkey_templ.go | 0 ui/layout.templ | 4 +- ui/layout_templ.go | 6 +- .../menus/assets_dropdown.templ | 0 .../menus/assets_dropdown_templ.go | 0 {components => ui}/menus/coins_dropdown.templ | 0 .../menus/coins_dropdown_templ.go | 12 +- ui/views/console.templ | 53 ++++ {components => ui}/views/console_templ.go | 230 +++++++++--------- ui/views/home.templ | 72 ++++++ {components => ui}/views/home_templ.go | 29 ++- ui/views/login.templ | 24 ++ {components => ui}/views/login_templ.go | 44 ++-- ui/views/register.templ | 30 +++ {components => ui}/views/register_templ.go | 46 ++-- 116 files changed, 828 insertions(+), 852 deletions(-) delete mode 100644 .github/workflows/cd.yml delete mode 100644 .github/workflows/check-pr.yml create mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/new-release.yml delete mode 100644 .github/workflows/new-tag.yml delete mode 100644 .github/workflows/post-merge.yml create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml delete mode 100644 components/inputs/input_handle.templ delete mode 100644 components/views/console.templ delete mode 100644 components/views/home.templ delete mode 100644 components/views/login.templ delete mode 100644 components/views/register.templ rename {middleware/controllers => controllers}/account/card.templ (100%) rename {middleware/controllers => controllers}/account/card_templ.go (91%) rename {middleware/controllers => controllers}/account/entity.go (100%) rename {middleware/controllers => controllers}/account/list.templ (100%) rename {middleware/controllers => controllers}/account/list_templ.go (100%) rename {middleware/controllers => controllers}/account/queries.go (100%) rename {middleware/controllers => controllers}/account/select.templ (100%) rename {middleware/controllers => controllers}/account/select_templ.go (100%) rename {middleware/controllers => controllers}/activity/card.templ (100%) rename {middleware/controllers => controllers}/activity/card_templ.go (91%) rename {middleware/controllers => controllers}/activity/entity.go (100%) rename {middleware/controllers => controllers}/activity/list.templ (100%) rename {middleware/controllers => controllers}/activity/list_templ.go (100%) rename {middleware/controllers => controllers}/activity/queries.go (100%) rename {middleware/controllers => controllers}/asset/entity.go (100%) rename {middleware/controllers => controllers}/asset/queries.go (100%) rename {middleware/controllers => controllers}/asset/select.templ (100%) rename {middleware/controllers => controllers}/asset/select_templ.go (100%) rename {middleware/controllers => controllers}/blockchain/entity.go (100%) rename {middleware/controllers => controllers}/blockchain/queries.go (100%) rename {middleware/controllers => controllers}/credential/descriptor.go (100%) rename {middleware/controllers => controllers}/credential/entity.go (100%) rename {middleware/controllers => controllers}/credential/inputs.templ (100%) rename {middleware/controllers => controllers}/credential/inputs_templ.go (100%) rename {middleware/controllers => controllers}/credential/queries.go (100%) rename {middleware/controllers => controllers}/health/entity.go (100%) rename {middleware/controllers => controllers}/health/queries.go (100%) rename {middleware/controllers => controllers}/prices/entity.go (100%) rename {middleware/controllers => controllers}/prices/queries.go (100%) rename {middleware/controllers => controllers}/profile/entity.go (100%) rename {middleware/controllers => controllers}/profile/inputs.templ (100%) rename {middleware/controllers => controllers}/profile/inputs_templ.go (100%) rename {middleware/controllers => controllers}/profile/queries.go (100%) rename {middleware/controllers => controllers}/service/entity.go (100%) rename {middleware/controllers => controllers}/service/queries.go (100%) rename {middleware/controllers => controllers}/vault/entity.go (100%) rename {middleware/controllers => controllers}/vault/forms.templ (100%) rename {middleware/controllers => controllers}/vault/forms_templ.go (100%) rename {middleware/controllers => controllers}/vault/options.go (82%) rename {middleware/controllers => controllers}/vault/queries.go (100%) rename handlers/{default_expired.go => default_error.go} (61%) create mode 100644 handlers/status_check.go create mode 100644 sink/base/errors.go rename {config => sink/config}/config.go (100%) rename {config => sink/config}/errors.go (100%) rename {config => sink/config}/server.go (100%) rename {cmd/vault => sink/migrations}/query.sql (100%) rename {cmd/vault => sink/migrations}/schema.sql (100%) rename components/dashboard/helia_console.templ => ui/app/helia/blocks.templ (93%) rename components/dashboard/helia_console_templ.go => ui/app/helia/blocks_templ.go (96%) create mode 100644 ui/app/helia/script.templ create mode 100644 ui/app/helia/script_templ.go rename {components => ui}/charts/area_chart.templ (100%) rename {components => ui}/charts/area_chart_templ.go (92%) rename {components => ui}/charts/bar_chart.templ (100%) rename {components => ui}/charts/bar_chart_templ.go (92%) rename {components => ui}/charts/candle_chart.templ (100%) rename {components => ui}/charts/candle_chart_templ.go (100%) rename {components => ui}/charts/line_chart.templ (100%) rename {components => ui}/charts/line_chart_templ.go (91%) rename {components => ui}/charts/pie_chart.templ (100%) rename {components => ui}/charts/pie_chart_templ.go (92%) rename {components => ui}/inputs/input_avatar.templ (100%) rename {components => ui}/inputs/input_avatar_templ.go (100%) rename {components => ui}/inputs/input_bio.templ (100%) rename {components => ui}/inputs/input_bio_templ.go (91%) create mode 100644 ui/inputs/input_handle.templ rename {components => ui}/inputs/input_handle_templ.go (78%) rename {components => ui}/inputs/input_passkey.templ (100%) rename {components => ui}/inputs/input_passkey_templ.go (100%) rename {components => ui}/menus/assets_dropdown.templ (100%) rename {components => ui}/menus/assets_dropdown_templ.go (100%) rename {components => ui}/menus/coins_dropdown.templ (100%) rename {components => ui}/menus/coins_dropdown_templ.go (91%) create mode 100644 ui/views/console.templ rename {components => ui}/views/console_templ.go (71%) create mode 100644 ui/views/home.templ rename {components => ui}/views/home_templ.go (78%) create mode 100644 ui/views/login.templ rename {components => ui}/views/login_templ.go (82%) create mode 100644 ui/views/register.templ rename {components => ui}/views/register_templ.go (83%) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index 44e00e2..0000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,67 +0,0 @@ -# This workflow will create a GitHub release every time a tag is pushed -name: Deploy @onsonr/es to npm - -on: - push: - branches: - - "master" - - "main" - -jobs: - release: - permissions: - contents: write - runs-on: ubuntu-latest - if: contains(github.event.head_commit.modified, 'src/') - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Get pnpm store directory - id: pnpm-cache - run: | - echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Setup pnpm cache - uses: actions/cache@v3 - with: - path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install deps (with cache) - run: pnpm install - - - name: Setup Git Config - run: | - git config user.name "Prad N." - git config user.email "prad@sonr.io" - - - name: Build - run: pnpm run build - - - name: "Automated Version Bump and Release" - run: | - git add . - git commit -m "chore: update build artifacts [skip ci]" || echo "No changes to commit" - pnpm version patch - git push - git push --tags - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - uses: JS-DevTools/npm-publish@v3 - with: - token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml deleted file mode 100644 index 1241d3b..0000000 --- a/.github/workflows/check-pr.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Check PR - -on: - pull_request: - merge_group: - -permissions: - contents: read # for TimonVS/pr-labeler-action to read config file - pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR - -jobs: - verify-pr: - name: Test Lints - if: github.event_name == 'pull_request' - permissions: - contents: read # for TimonVS/pr-labeler-action to read config file - pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Required to fetch all history for merging - - - uses: TimonVS/pr-labeler-action@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value - - name: Trunk Check - uses: trunk-io/trunk-action@v1 - - test-builds: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - name: Test Builds - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: onsonr/sonr - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - - name: Run Sonrd Build - run: make build - - test-unit: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - name: Test Unit - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: onsonr/sonr - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - - run: make test-unit - - test-race: - runs-on: ubuntu-latest - if: github.event_name == 'merge_group' - name: Test Race - continue-on-error: true - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: onsonr/sonr - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - - run: make test-race - - test-cover: - runs-on: ubuntu-latest - if: github.event_name == 'merge_group' - name: Test Coverage - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: onsonr/sonr - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - - run: make test-cover - - validate-release: - if: github.event_name == 'merge_group' || github.event_name == 'pull_request' - runs-on: ubuntu-latest - name: Test Release - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: onsonr/sonr - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - - - name: Commitizen Dry Run - uses: commitizen-tools/commitizen-action@master - with: - push: false - dry_run: true - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: main - - - name: Check GoReleaser Config - run: make release-check - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: GoReleaser Dry Run - run: make release-dry - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..5804717 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,30 @@ +name: Deploy Worker +on: + push: + workflow_dispatch: + workflow_call: + +jobs: + wrangler: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: current + + - name: Deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + workingDirectory: cmd/vault diff --git a/.github/workflows/new-release.yml b/.github/workflows/new-release.yml deleted file mode 100644 index 5187773..0000000 --- a/.github/workflows/new-release.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: New Release -on: - release: - types: [published] - -permissions: - contents: write - issues: write - -jobs: - buf_push: - name: Publish Protobufs - runs-on: ubuntu-latest - steps: - # Run `git checkout` - - uses: actions/checkout@v4 - # Install the `buf` CLI - - uses: bufbuild/buf-setup-action@v1 - # Push only the Input in `proto` to the BSR - - uses: bufbuild/buf-push-action@v1 - continue-on-error: true - with: - input: proto - buf_token: ${{ secrets.BUF_TOKEN }} - - container-push: - name: Publish Docker Images - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ghcr.io/onsonr/sonr:latest - - docs-push: - runs-on: ubuntu-latest - name: Publish Tech Docs - steps: - - uses: actions/checkout@v4 - - name: Configure Git Credentials - run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v4 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - run: pip install mkdocs-material - - run: mkdocs gh-deploy --force diff --git a/.github/workflows/new-tag.yml b/.github/workflows/new-tag.yml deleted file mode 100644 index 63ce139..0000000 --- a/.github/workflows/new-tag.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: New Tag - -on: - pull_request: - types: [closed] - push: - tags: - - v* - branches: - - main - -permissions: - contents: write - -jobs: - new-release: - name: Create Release - if: startsWith(github.ref, 'refs/tags/') - permissions: write-all - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - repository: onsonr/sonr - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Run GoReleaser - run: make release - env: - GITHUB_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }} - GITHUB_PERSONAL_AUTH_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} - REDDIT_APP_ID: ${{ secrets.REDDIT_APP_ID }} - REDDIT_SECRET: ${{ secrets.REDDIT_SECRET }} - REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }} - REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }} diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml deleted file mode 100644 index 44f1cf5..0000000 --- a/.github/workflows/post-merge.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Post Merge -on: - pull_request: - types: [closed] - -permissions: - contents: write - issues: write - -jobs: - bump-version: - name: Version Bump - if: | - github.event.pull_request.merged == true && - github.event.pull_request.user.login != 'dependabot[bot]' && - github.event.pull_request.user.login != 'dependabot-preview[bot]' - runs-on: ubuntu-latest - steps: - - name: Check out - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ssh-key: "${{ secrets.COMMIT_KEY }}" - - - name: Create bump and changelog - uses: commitizen-tools/commitizen-action@master - with: - push: false - increment: patch - - - name: Push using ssh - run: | - git push origin main --tags diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f5899d1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: New Release +on: + push: + tags: + - "v*.*.*" + - "*" + +permissions: + contents: write + issues: write + packages: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GH_PAT }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..6ac05f4 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,43 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj +version: 2 + +before: + hooks: + - go mod tidy + - sqlc generate + - templ generate + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + +archives: + - formats: [tar.gz] + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + format_overrides: + - goos: windows + formats: [zip] + +changelog: + sort: desc + filters: + exclude: + - "^docs:" + - "^test:" + +release: + footer: >- + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). diff --git a/README.md b/README.md index b04bd6a..d182a54 100644 --- a/README.md +++ b/README.md @@ -33,64 +33,56 @@ docker-compose up -d ## Usage -### Run Using Docker +### Development Setup -The simplest way to run the full Motr system is with Docker Compose: +Motr uses [Task](https://taskfile.dev) for managing development workflows. Here are the primary commands: ```bash -# Start all services -docker-compose up -d +# Clean build artifacts +task clean -# View logs -docker-compose logs -f +# Build all components +task build -# Stop services -docker-compose down +# Deploy all components to Cloudflare +task deploy + +# Start the local development server +task serve ``` -### Run as a Local Server +### Component-specific commands -```go -package main +```bash +# Start the Vault component (Cloudflare Worker) +task start:vault -import ( - "database/sql" - "log" +# Start the Frontend component +task start:front - "github.com/sonr-io/motr/app" - "github.com/sonr-io/motr/pkg/models" - "github.com/sonr-io/motr/pkg/types" -) +# Build specific components +task build:vault +task build:front -func main() { - dbq, err := setupDatabase() - if err != nil { - log.Fatal(err) - } +# Deploy specific components to Cloudflare +task deploy:vault +task deploy:front +``` - config := &types.Config{ - MotrToken: "your-token", - SonrChainID: "sonr-testnet-1", - // Other configuration options - } +### Database operations - vault, err := app.New(config, dbq) - if err != nil { - log.Fatal(err) - } +```bash +# Generate SQL models using sqlc +task gen:sqlc - // Start the server - vault.Start(":8080") -} - -func setupDatabase() (*models.Queries, error) { - // Initialize your database connection - // ... -} +# Migrate the database +task db:migrate ``` ### Compile to WebAssembly +The project uses WebAssembly for cross-platform compatibility. Components are compiled automatically when using the Task commands above, but you can also build manually: + ```sh # Build the signer as WASM GOOS=js GOARCH=wasm go build -o build/signer.wasm ./cmd/signer/main.go @@ -115,6 +107,7 @@ Motr can be integrated into progressive web applications, providing: Motr consists of several components: +- **Vault**: Core component deployed as a Cloudflare Worker with WebAssembly - **Controller**: Manages WebAuthn credential creation and verification - **Resolver**: Handles name resolution and identity lookups - **Signer**: WebAssembly-based cryptographic operations for secure signing @@ -124,27 +117,62 @@ Motr consists of several components: ### Component Details -1. **Controller** +1. **Vault** + - Core component deployed as a Cloudflare Worker + - Manages decentralized identity and authentication + - Integrates with IPFS/Helia for decentralized storage + - Uses WebAssembly plugins for cryptographic operations + - Package located at `cmd/vault/` +2. **Controller** - Manages user credentials and authentication - Integrates with WebAuthn for credential storage - - Containerized for easy deployment - -2. **Resolver** + - Uses SQLite via D1 database for persistent storage +3. **Resolver** - Resolves Sonr names to addresses and profiles - Serves as a gateway to the Sonr network - Implemented as a Cloudflare Worker -3. **Signer** +4. **Signer** - Secure cryptographic operations - WebAssembly-based for cross-platform compatibility - Handles key management and signatures +## Development + +### Build System + +Motr uses the following build tools: + +- **Task**: Task runner for development workflows +- **GoReleaser**: Handles building and releasing Go applications +- **SQLC**: Generates type-safe Go code from SQL +- **Templ**: Template engine for Go HTML templates +- **Air**: Live reload for Go applications during development +- **Bun**: JavaScript runtime and package manager + +### Release Process + +```bash +# Create a new release +task release +``` + +The release process uses GoReleaser with configuration in `.goreleaser.yaml`. + ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. +To contribute: + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes using conventional commits (`git commit -m 'feat: add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + ## License [MIT](LICENSE) diff --git a/Taskfile.yml b/Taskfile.yml index 5b0e9ac..17e27ad 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -13,6 +13,10 @@ tasks: - task: tidy:front - task: tidy:root + serve: + desc: Serve the app with air + cmd: air + deploy: desc: Deploy all cmds: diff --git a/cmd/front/main.go b/cmd/front/main.go index 13c8c30..faddb7c 100644 --- a/cmd/front/main.go +++ b/cmd/front/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/sonr-io/motr/config" "github.com/sonr-io/motr/middleware" "github.com/sonr-io/motr/routes" + "github.com/sonr-io/motr/sink/config" ) func main() { diff --git a/cmd/vault/main.go b/cmd/vault/main.go index 57c0db6..7277f73 100644 --- a/cmd/vault/main.go +++ b/cmd/vault/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/sonr-io/motr/config" "github.com/sonr-io/motr/middleware" "github.com/sonr-io/motr/routes" + "github.com/sonr-io/motr/sink/config" ) func main() { diff --git a/components/inputs/input_handle.templ b/components/inputs/input_handle.templ deleted file mode 100644 index a826406..0000000 --- a/components/inputs/input_handle.templ +++ /dev/null @@ -1,33 +0,0 @@ -package inputs - -templ HandleInitial() { -
- -
- -
-
-
-
-} - -templ HandleError(value string, helpText string) { - -
- -
-
- -
-
-
-} - -templ HandleSuccess(value string) { - -
- -
-
-
-} diff --git a/components/views/console.templ b/components/views/console.templ deleted file mode 100644 index 4d2e51f..0000000 --- a/components/views/console.templ +++ /dev/null @@ -1,91 +0,0 @@ -package views - -import ( - "github.com/sonr-io/motr/ui" - "github.com/sonr-io/motr/components/dashboard" - "time" -) - -var heliaCardScriptHandle = templ.NewOnceHandle() - -func DemoView(d time.Time) templ.Component { - return demoComponent(d) -} - -templ demoComponent(d time.Time) { - @ui.HTML() { - @ui.Head() { - } - - @ui.Nav() { - @ui.NavLeft() { - @ui.NavLogo("Motr") - } - @ui.NavRight() { - Time - } - } - @ui.Body() { - - @ui.Container() { -
-
- @dashboard.HeliaStatusCard() - @dashboard.HeliaNodeIDCard() - @dashboard.HeliaDiscoveredPeersCard() - @dashboard.HeliaConnectedPeersCard() -
-
- @dashboard.HeliaConnectedPeersList() - @dashboard.HeliaRunningLog() -
- @heliaCardScriptHandle.Once() { - - } -
- } -
- } -
- } -} diff --git a/components/views/home.templ b/components/views/home.templ deleted file mode 100644 index b3cc49b..0000000 --- a/components/views/home.templ +++ /dev/null @@ -1,48 +0,0 @@ -package views - -import ( - "github.com/sonr-io/motr/sink" - "github.com/sonr-io/motr/ui" -) - -var meta = sink.DefaultMetadata() - -func HomeView() templ.Component { - return homeComponent() -} - -templ homeComponent() { - @ui.HTML() { - @ui.Head() { - @ui.MetaComponent(meta) - } - - @ui.Nav() { - @ui.NavLeft() { - @ui.NavLogo("Motr") - } - @ui.NavRight() { - } - } - @ui.Body() { - @ui.Container() { - -
-

Welcome to Motr

-
-
-

This is a demo of the Motr web app.

-

You can use this app to manage your Motr account.

-
- -
- } - } -
- } -} diff --git a/components/views/login.templ b/components/views/login.templ deleted file mode 100644 index 1453a36..0000000 --- a/components/views/login.templ +++ /dev/null @@ -1,25 +0,0 @@ -package views - -import ( - "github.com/sonr-io/motr/ui" -) - -templ LoginView() { - @ui.HTML() { - @ui.Head() { - @ui.MetaComponent(meta) - } - - @ui.Nav() { - @ui.NavLeft() { - @ui.NavLogo("Motr") - } - @ui.NavRight() { - } - } - @ui.Body() { - } - - } -} - diff --git a/components/views/register.templ b/components/views/register.templ deleted file mode 100644 index c619961..0000000 --- a/components/views/register.templ +++ /dev/null @@ -1,28 +0,0 @@ -package views - -import ( - "github.com/sonr-io/motr/ui" - "github.com/sonr-io/motr/components/inputs" -) - -templ RegisterView() { - @ui.HTML() { - @ui.Head() { - @ui.MetaComponent(meta) - } - - @ui.Nav() { - @ui.NavLeft() { - @ui.NavLogo("Motr") - } - @ui.NavRight() { - } - } - @ui.Body() { - @ui.Container() { - @inputs.HandleInitial() - } - } - - } -} diff --git a/middleware/controllers/account/card.templ b/controllers/account/card.templ similarity index 100% rename from middleware/controllers/account/card.templ rename to controllers/account/card.templ diff --git a/middleware/controllers/account/card_templ.go b/controllers/account/card_templ.go similarity index 91% rename from middleware/controllers/account/card_templ.go rename to controllers/account/card_templ.go index 332b7e0..9421de2 100644 --- a/middleware/controllers/account/card_templ.go +++ b/controllers/account/card_templ.go @@ -38,7 +38,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(handle) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/account/card.templ`, Line: 11, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/account/card.templ`, Line: 11, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -51,7 +51,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(addr) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/account/card.templ`, Line: 18, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/account/card.templ`, Line: 18, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -64,7 +64,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(block) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/account/card.templ`, Line: 23, Col: 47} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/account/card.templ`, Line: 23, Col: 47} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -77,7 +77,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/account/card.templ`, Line: 27, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/account/card.templ`, Line: 27, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -120,7 +120,7 @@ func optionComponent(account models.Account) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(account.Address) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/account/card.templ`, Line: 37, Col: 19} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/account/card.templ`, Line: 37, Col: 19} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -163,7 +163,7 @@ func rowComponent(account models.Account) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(account.Address) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/account/card.templ`, Line: 45, Col: 19} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/account/card.templ`, Line: 45, Col: 19} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { diff --git a/middleware/controllers/account/entity.go b/controllers/account/entity.go similarity index 100% rename from middleware/controllers/account/entity.go rename to controllers/account/entity.go diff --git a/middleware/controllers/account/list.templ b/controllers/account/list.templ similarity index 100% rename from middleware/controllers/account/list.templ rename to controllers/account/list.templ diff --git a/middleware/controllers/account/list_templ.go b/controllers/account/list_templ.go similarity index 100% rename from middleware/controllers/account/list_templ.go rename to controllers/account/list_templ.go diff --git a/middleware/controllers/account/queries.go b/controllers/account/queries.go similarity index 100% rename from middleware/controllers/account/queries.go rename to controllers/account/queries.go diff --git a/middleware/controllers/account/select.templ b/controllers/account/select.templ similarity index 100% rename from middleware/controllers/account/select.templ rename to controllers/account/select.templ diff --git a/middleware/controllers/account/select_templ.go b/controllers/account/select_templ.go similarity index 100% rename from middleware/controllers/account/select_templ.go rename to controllers/account/select_templ.go diff --git a/middleware/controllers/activity/card.templ b/controllers/activity/card.templ similarity index 100% rename from middleware/controllers/activity/card.templ rename to controllers/activity/card.templ diff --git a/middleware/controllers/activity/card_templ.go b/controllers/activity/card_templ.go similarity index 91% rename from middleware/controllers/activity/card_templ.go rename to controllers/activity/card_templ.go index a0a3036..6a2eb31 100644 --- a/middleware/controllers/activity/card_templ.go +++ b/controllers/activity/card_templ.go @@ -38,7 +38,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(handle) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/activity/card.templ`, Line: 11, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/activity/card.templ`, Line: 11, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -51,7 +51,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(addr) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/activity/card.templ`, Line: 18, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/activity/card.templ`, Line: 18, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -64,7 +64,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(block) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/activity/card.templ`, Line: 23, Col: 47} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/activity/card.templ`, Line: 23, Col: 47} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -77,7 +77,7 @@ func cardComponent(handle, addr, block, name string) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/activity/card.templ`, Line: 27, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/activity/card.templ`, Line: 27, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -120,7 +120,7 @@ func optionComponent(account models.Activity) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(account.Status) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/activity/card.templ`, Line: 37, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/activity/card.templ`, Line: 37, Col: 18} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -163,7 +163,7 @@ func rowComponent(account models.Activity) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(account.Status) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `middleware/controllers/activity/card.templ`, Line: 45, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `controllers/activity/card.templ`, Line: 45, Col: 18} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { diff --git a/middleware/controllers/activity/entity.go b/controllers/activity/entity.go similarity index 100% rename from middleware/controllers/activity/entity.go rename to controllers/activity/entity.go diff --git a/middleware/controllers/activity/list.templ b/controllers/activity/list.templ similarity index 100% rename from middleware/controllers/activity/list.templ rename to controllers/activity/list.templ diff --git a/middleware/controllers/activity/list_templ.go b/controllers/activity/list_templ.go similarity index 100% rename from middleware/controllers/activity/list_templ.go rename to controllers/activity/list_templ.go diff --git a/middleware/controllers/activity/queries.go b/controllers/activity/queries.go similarity index 100% rename from middleware/controllers/activity/queries.go rename to controllers/activity/queries.go diff --git a/middleware/controllers/asset/entity.go b/controllers/asset/entity.go similarity index 100% rename from middleware/controllers/asset/entity.go rename to controllers/asset/entity.go diff --git a/middleware/controllers/asset/queries.go b/controllers/asset/queries.go similarity index 100% rename from middleware/controllers/asset/queries.go rename to controllers/asset/queries.go diff --git a/middleware/controllers/asset/select.templ b/controllers/asset/select.templ similarity index 100% rename from middleware/controllers/asset/select.templ rename to controllers/asset/select.templ diff --git a/middleware/controllers/asset/select_templ.go b/controllers/asset/select_templ.go similarity index 100% rename from middleware/controllers/asset/select_templ.go rename to controllers/asset/select_templ.go diff --git a/middleware/controllers/blockchain/entity.go b/controllers/blockchain/entity.go similarity index 100% rename from middleware/controllers/blockchain/entity.go rename to controllers/blockchain/entity.go diff --git a/middleware/controllers/blockchain/queries.go b/controllers/blockchain/queries.go similarity index 100% rename from middleware/controllers/blockchain/queries.go rename to controllers/blockchain/queries.go diff --git a/middleware/controllers/credential/descriptor.go b/controllers/credential/descriptor.go similarity index 100% rename from middleware/controllers/credential/descriptor.go rename to controllers/credential/descriptor.go diff --git a/middleware/controllers/credential/entity.go b/controllers/credential/entity.go similarity index 100% rename from middleware/controllers/credential/entity.go rename to controllers/credential/entity.go diff --git a/middleware/controllers/credential/inputs.templ b/controllers/credential/inputs.templ similarity index 100% rename from middleware/controllers/credential/inputs.templ rename to controllers/credential/inputs.templ diff --git a/middleware/controllers/credential/inputs_templ.go b/controllers/credential/inputs_templ.go similarity index 100% rename from middleware/controllers/credential/inputs_templ.go rename to controllers/credential/inputs_templ.go diff --git a/middleware/controllers/credential/queries.go b/controllers/credential/queries.go similarity index 100% rename from middleware/controllers/credential/queries.go rename to controllers/credential/queries.go diff --git a/middleware/controllers/health/entity.go b/controllers/health/entity.go similarity index 100% rename from middleware/controllers/health/entity.go rename to controllers/health/entity.go diff --git a/middleware/controllers/health/queries.go b/controllers/health/queries.go similarity index 100% rename from middleware/controllers/health/queries.go rename to controllers/health/queries.go diff --git a/middleware/controllers/prices/entity.go b/controllers/prices/entity.go similarity index 100% rename from middleware/controllers/prices/entity.go rename to controllers/prices/entity.go diff --git a/middleware/controllers/prices/queries.go b/controllers/prices/queries.go similarity index 100% rename from middleware/controllers/prices/queries.go rename to controllers/prices/queries.go diff --git a/middleware/controllers/profile/entity.go b/controllers/profile/entity.go similarity index 100% rename from middleware/controllers/profile/entity.go rename to controllers/profile/entity.go diff --git a/middleware/controllers/profile/inputs.templ b/controllers/profile/inputs.templ similarity index 100% rename from middleware/controllers/profile/inputs.templ rename to controllers/profile/inputs.templ diff --git a/middleware/controllers/profile/inputs_templ.go b/controllers/profile/inputs_templ.go similarity index 100% rename from middleware/controllers/profile/inputs_templ.go rename to controllers/profile/inputs_templ.go diff --git a/middleware/controllers/profile/queries.go b/controllers/profile/queries.go similarity index 100% rename from middleware/controllers/profile/queries.go rename to controllers/profile/queries.go diff --git a/middleware/controllers/service/entity.go b/controllers/service/entity.go similarity index 100% rename from middleware/controllers/service/entity.go rename to controllers/service/entity.go diff --git a/middleware/controllers/service/queries.go b/controllers/service/queries.go similarity index 100% rename from middleware/controllers/service/queries.go rename to controllers/service/queries.go diff --git a/middleware/controllers/vault/entity.go b/controllers/vault/entity.go similarity index 100% rename from middleware/controllers/vault/entity.go rename to controllers/vault/entity.go diff --git a/middleware/controllers/vault/forms.templ b/controllers/vault/forms.templ similarity index 100% rename from middleware/controllers/vault/forms.templ rename to controllers/vault/forms.templ diff --git a/middleware/controllers/vault/forms_templ.go b/controllers/vault/forms_templ.go similarity index 100% rename from middleware/controllers/vault/forms_templ.go rename to controllers/vault/forms_templ.go diff --git a/middleware/controllers/vault/options.go b/controllers/vault/options.go similarity index 82% rename from middleware/controllers/vault/options.go rename to controllers/vault/options.go index 12af4da..7e68ac7 100644 --- a/middleware/controllers/vault/options.go +++ b/controllers/vault/options.go @@ -1,6 +1,6 @@ package vault -import "github.com/sonr-io/motr/middleware/controllers/credential" +import "github.com/sonr-io/motr/controllers/credential" type LoginOptions struct { Account string diff --git a/middleware/controllers/vault/queries.go b/controllers/vault/queries.go similarity index 100% rename from middleware/controllers/vault/queries.go rename to controllers/vault/queries.go diff --git a/handlers/default_expired.go b/handlers/default_error.go similarity index 61% rename from handlers/default_expired.go rename to handlers/default_error.go index 2cd0c62..4caf549 100644 --- a/handlers/default_expired.go +++ b/handlers/default_error.go @@ -2,10 +2,10 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) -func HandleDefaultExpired(c echo.Context) error { +func HandleDefaultError(c echo.Context) error { return middleware.Render(c, views.HomeView()) } diff --git a/handlers/default_index.go b/handlers/default_index.go index e9b48f0..6922a49 100644 --- a/handlers/default_index.go +++ b/handlers/default_index.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleDefaultIndex(c echo.Context) error { diff --git a/handlers/default_valid.go b/handlers/default_valid.go index aabf62b..9c2c03b 100644 --- a/handlers/default_valid.go +++ b/handlers/default_valid.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleDefaultValid(c echo.Context) error { diff --git a/handlers/login_check.go b/handlers/login_check.go index 2ca27df..a7915c5 100644 --- a/handlers/login_check.go +++ b/handlers/login_check.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleLoginCheck(c echo.Context) error { diff --git a/handlers/login_finish.go b/handlers/login_finish.go index be56ab8..afd134b 100644 --- a/handlers/login_finish.go +++ b/handlers/login_finish.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleLoginFinish(c echo.Context) error { diff --git a/handlers/login_initial.go b/handlers/login_initial.go index ab1142d..5c838d3 100644 --- a/handlers/login_initial.go +++ b/handlers/login_initial.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleLoginInitial(c echo.Context) error { diff --git a/handlers/login_start.go b/handlers/login_start.go index 17c1464..43fe71f 100644 --- a/handlers/login_start.go +++ b/handlers/login_start.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleLoginStart(c echo.Context) error { diff --git a/handlers/register_check.go b/handlers/register_check.go index c9ed655..32c5005 100644 --- a/handlers/register_check.go +++ b/handlers/register_check.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleRegisterCheck(c echo.Context) error { diff --git a/handlers/register_finish.go b/handlers/register_finish.go index 86f72b1..644774b 100644 --- a/handlers/register_finish.go +++ b/handlers/register_finish.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleRegisterFinish(c echo.Context) error { diff --git a/handlers/register_initial.go b/handlers/register_initial.go index 6057916..11c7155 100644 --- a/handlers/register_initial.go +++ b/handlers/register_initial.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleRegisterInitial(c echo.Context) error { diff --git a/handlers/register_start.go b/handlers/register_start.go index 8a22dbb..d441ee4 100644 --- a/handlers/register_start.go +++ b/handlers/register_start.go @@ -2,8 +2,8 @@ package handlers import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/components/views" "github.com/sonr-io/motr/middleware" + "github.com/sonr-io/motr/ui/views" ) func HandleRegisterStart(c echo.Context) error { diff --git a/handlers/status_check.go b/handlers/status_check.go new file mode 100644 index 0000000..b5eb84a --- /dev/null +++ b/handlers/status_check.go @@ -0,0 +1,38 @@ +package handlers + +import ( + "github.com/labstack/echo/v4" +) + +// StatusCheck is a struct that represents the status of the application +type StatusCheck struct { + Ok bool `json:"ok"` + Services []struct { + Name string `json:"name"` + Ok bool `json:"ok"` + } `json:"services"` +} + +// HandleStatusCheck is a handler that checks the status of the application +func HandleStatusCheck(c echo.Context) error { + return c.JSON(200, StatusCheck{ + Ok: true, + Services: []struct { + Name string `json:"name"` + Ok bool `json:"ok"` + }{ + { + Name: "IPFS", + Ok: true, + }, + { + Name: "IBC", + Ok: true, + }, + { + Name: "Sonr", + Ok: true, + }, + }, + }) +} diff --git a/middleware/cache.go b/middleware/cache.go index a97a669..6f85d37 100644 --- a/middleware/cache.go +++ b/middleware/cache.go @@ -10,7 +10,7 @@ import ( "strconv" "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/config" + "github.com/sonr-io/motr/sink/config" "github.com/syumai/workers/cloudflare" "github.com/syumai/workers/cloudflare/cache" ) diff --git a/middleware/context.go b/middleware/context.go index 589f4b6..3cd7d73 100644 --- a/middleware/context.go +++ b/middleware/context.go @@ -8,8 +8,8 @@ import ( "github.com/labstack/echo/v4" "github.com/segmentio/ksuid" - "github.com/sonr-io/motr/config" "github.com/sonr-io/motr/sink" + "github.com/sonr-io/motr/sink/config" "github.com/sonr-io/motr/sink/models" "github.com/syumai/workers/cloudflare/kv" ) diff --git a/middleware/middleware.go b/middleware/middleware.go index f5d37f8..5d16d5b 100644 --- a/middleware/middleware.go +++ b/middleware/middleware.go @@ -5,7 +5,7 @@ package middleware import ( "github.com/labstack/echo/v4" - "github.com/sonr-io/motr/config" + "github.com/sonr-io/motr/sink/config" ) // UseSession is a middleware that adds a new key to the context diff --git a/routes/routes.go b/routes/routes.go index a2413dc..9ed7cd2 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -4,14 +4,14 @@ package routes import ( - "github.com/sonr-io/motr/config" "github.com/sonr-io/motr/handlers" + "github.com/sonr-io/motr/sink/config" ) func SetupRoutes(c *config.Server) { // Home c.GET("/", handlers.HandleDefaultIndex) - c.GET("/expired", handlers.HandleDefaultExpired) + c.GET("/expired", handlers.HandleDefaultError) c.GET("/valid", handlers.HandleDefaultValid) // Login @@ -25,4 +25,7 @@ func SetupRoutes(c *config.Server) { c.GET("/register/:handle", handlers.HandleRegisterStart) c.POST("/register/:handle/check", handlers.HandleRegisterCheck) c.POST("/register/:handle/finish", handlers.HandleRegisterFinish) + + // Status + c.GET("/status", handlers.HandleStatusCheck) } diff --git a/sink/base/errors.go b/sink/base/errors.go new file mode 100644 index 0000000..2c09652 --- /dev/null +++ b/sink/base/errors.go @@ -0,0 +1,10 @@ +package base + +import ( + "errors" +) + +var ( + ErrInvalidRequest = errors.New("invalid request") + ErrNotFound = errors.New("not found") +) diff --git a/config/config.go b/sink/config/config.go similarity index 100% rename from config/config.go rename to sink/config/config.go diff --git a/config/errors.go b/sink/config/errors.go similarity index 100% rename from config/errors.go rename to sink/config/errors.go diff --git a/config/server.go b/sink/config/server.go similarity index 100% rename from config/server.go rename to sink/config/server.go diff --git a/cmd/vault/query.sql b/sink/migrations/query.sql similarity index 100% rename from cmd/vault/query.sql rename to sink/migrations/query.sql diff --git a/cmd/vault/schema.sql b/sink/migrations/schema.sql similarity index 100% rename from cmd/vault/schema.sql rename to sink/migrations/schema.sql diff --git a/sqlc.yaml b/sqlc.yaml index 06d9723..f5a8701 100644 --- a/sqlc.yaml +++ b/sqlc.yaml @@ -1,11 +1,11 @@ version: "2" sql: - engine: "sqlite" - queries: "./cmd/vault/query.sql" - schema: "./cmd/vault/schema.sql" + queries: "./sink/migrations/query.sql" + schema: "./sink/migrations/schema.sql" gen: go: emit_interface: true emit_json_tags: true package: "models" - out: "./internal/sink/models" + out: "./sink/models" diff --git a/components/dashboard/helia_console.templ b/ui/app/helia/blocks.templ similarity index 93% rename from components/dashboard/helia_console.templ rename to ui/app/helia/blocks.templ index 8ef3e6e..eb77c9c 100644 --- a/components/dashboard/helia_console.templ +++ b/ui/app/helia/blocks.templ @@ -1,7 +1,7 @@ -package dashboard +package helia // StatusCard component for displaying Helia node status -templ HeliaStatusCard() { +templ StatusCard() {

@@ -18,7 +18,7 @@ templ HeliaStatusCard() { } // NodeIDCard component for displaying Helia node ID -templ HeliaNodeIDCard() { +templ NodeIDCard() {
@@ -36,7 +36,7 @@ templ HeliaNodeIDCard() { } // DiscoveredPeersCard component for displaying discovered peers count -templ HeliaDiscoveredPeersCard() { +templ DiscoveredPeersCard() {

@@ -52,7 +52,7 @@ templ HeliaDiscoveredPeersCard() { } // ConnectedPeersCard component for displaying connected peers count -templ HeliaConnectedPeersCard() { +templ ConnectedPeersCard() {

@@ -67,7 +67,7 @@ templ HeliaConnectedPeersCard() { } // Optional: Create a component for a connected peers list if needed -templ HeliaConnectedPeersList() { +templ ConnectedPeersList() {

Connected Peers List

    @@ -75,7 +75,7 @@ templ HeliaConnectedPeersList() { } // Optional: Create a component for the running log -templ HeliaRunningLog() { +templ RunningLog() {

    Running Log

    diff --git a/components/dashboard/helia_console_templ.go b/ui/app/helia/blocks_templ.go similarity index 96% rename from components/dashboard/helia_console_templ.go rename to ui/app/helia/blocks_templ.go index c644ede..8c6fe24 100644 --- a/components/dashboard/helia_console_templ.go +++ b/ui/app/helia/blocks_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.3.857 -package dashboard +package helia //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -9,7 +9,7 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" // StatusCard component for displaying Helia node status -func HeliaStatusCard() templ.Component { +func StatusCard() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -39,7 +39,7 @@ func HeliaStatusCard() templ.Component { } // NodeIDCard component for displaying Helia node ID -func HeliaNodeIDCard() templ.Component { +func NodeIDCard() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -69,7 +69,7 @@ func HeliaNodeIDCard() templ.Component { } // DiscoveredPeersCard component for displaying discovered peers count -func HeliaDiscoveredPeersCard() templ.Component { +func DiscoveredPeersCard() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -99,7 +99,7 @@ func HeliaDiscoveredPeersCard() templ.Component { } // ConnectedPeersCard component for displaying connected peers count -func HeliaConnectedPeersCard() templ.Component { +func ConnectedPeersCard() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -129,7 +129,7 @@ func HeliaConnectedPeersCard() templ.Component { } // Optional: Create a component for a connected peers list if needed -func HeliaConnectedPeersList() templ.Component { +func ConnectedPeersList() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -159,7 +159,7 @@ func HeliaConnectedPeersList() templ.Component { } // Optional: Create a component for the running log -func HeliaRunningLog() templ.Component { +func RunningLog() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { diff --git a/ui/app/helia/script.templ b/ui/app/helia/script.templ new file mode 100644 index 0000000..2624745 --- /dev/null +++ b/ui/app/helia/script.templ @@ -0,0 +1,49 @@ +package helia + +var heliaCardScriptHandle = templ.NewOnceHandle() + +templ ScriptTag() { + @heliaCardScriptHandle.Once() { + + } +} diff --git a/ui/app/helia/script_templ.go b/ui/app/helia/script_templ.go new file mode 100644 index 0000000..78ac4a5 --- /dev/null +++ b/ui/app/helia/script_templ.go @@ -0,0 +1,60 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.857 +package helia + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +var heliaCardScriptHandle = templ.NewOnceHandle() + +func ScriptTag() templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = heliaCardScriptHandle.Once().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/components/charts/area_chart.templ b/ui/charts/area_chart.templ similarity index 100% rename from components/charts/area_chart.templ rename to ui/charts/area_chart.templ diff --git a/components/charts/area_chart_templ.go b/ui/charts/area_chart_templ.go similarity index 92% rename from components/charts/area_chart_templ.go rename to ui/charts/area_chart_templ.go index 43a18d4..a12d377 100644 --- a/components/charts/area_chart_templ.go +++ b/ui/charts/area_chart_templ.go @@ -44,7 +44,7 @@ func AreaChart(data []DateValue) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(d.Date) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/area_chart.templ`, Line: 14, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/area_chart.templ`, Line: 14, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -57,7 +57,7 @@ func AreaChart(data []DateValue) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", d.Value)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/area_chart.templ`, Line: 15, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/area_chart.templ`, Line: 15, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/components/charts/bar_chart.templ b/ui/charts/bar_chart.templ similarity index 100% rename from components/charts/bar_chart.templ rename to ui/charts/bar_chart.templ diff --git a/components/charts/bar_chart_templ.go b/ui/charts/bar_chart_templ.go similarity index 92% rename from components/charts/bar_chart_templ.go rename to ui/charts/bar_chart_templ.go index e458bfe..489d55e 100644 --- a/components/charts/bar_chart_templ.go +++ b/ui/charts/bar_chart_templ.go @@ -45,7 +45,7 @@ func BarChart(data []KeyValue) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(d.Key) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/bar_chart.templ`, Line: 15, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/bar_chart.templ`, Line: 15, Col: 60} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -58,7 +58,7 @@ func BarChart(data []KeyValue) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", d.Value)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/bar_chart.templ`, Line: 16, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/bar_chart.templ`, Line: 16, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/components/charts/candle_chart.templ b/ui/charts/candle_chart.templ similarity index 100% rename from components/charts/candle_chart.templ rename to ui/charts/candle_chart.templ diff --git a/components/charts/candle_chart_templ.go b/ui/charts/candle_chart_templ.go similarity index 100% rename from components/charts/candle_chart_templ.go rename to ui/charts/candle_chart_templ.go diff --git a/components/charts/line_chart.templ b/ui/charts/line_chart.templ similarity index 100% rename from components/charts/line_chart.templ rename to ui/charts/line_chart.templ diff --git a/components/charts/line_chart_templ.go b/ui/charts/line_chart_templ.go similarity index 91% rename from components/charts/line_chart_templ.go rename to ui/charts/line_chart_templ.go index ef0474d..12659ac 100644 --- a/components/charts/line_chart_templ.go +++ b/ui/charts/line_chart_templ.go @@ -39,7 +39,7 @@ func LineChart(data []DateValue) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(d.Date) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/line_chart.templ`, Line: 9, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/line_chart.templ`, Line: 9, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -52,7 +52,7 @@ func LineChart(data []DateValue) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", d.Value)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/line_chart.templ`, Line: 10, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/line_chart.templ`, Line: 10, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/components/charts/pie_chart.templ b/ui/charts/pie_chart.templ similarity index 100% rename from components/charts/pie_chart.templ rename to ui/charts/pie_chart.templ diff --git a/components/charts/pie_chart_templ.go b/ui/charts/pie_chart_templ.go similarity index 92% rename from components/charts/pie_chart_templ.go rename to ui/charts/pie_chart_templ.go index 1d76407..3d57d2d 100644 --- a/components/charts/pie_chart_templ.go +++ b/ui/charts/pie_chart_templ.go @@ -46,7 +46,7 @@ func PieChart(data []CategoryValue) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(d.Category) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/pie_chart.templ`, Line: 16, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/pie_chart.templ`, Line: 16, Col: 65} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -59,7 +59,7 @@ func PieChart(data []CategoryValue) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", d.Value)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/charts/pie_chart.templ`, Line: 17, Col: 81} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/charts/pie_chart.templ`, Line: 17, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/components/inputs/input_avatar.templ b/ui/inputs/input_avatar.templ similarity index 100% rename from components/inputs/input_avatar.templ rename to ui/inputs/input_avatar.templ diff --git a/components/inputs/input_avatar_templ.go b/ui/inputs/input_avatar_templ.go similarity index 100% rename from components/inputs/input_avatar_templ.go rename to ui/inputs/input_avatar_templ.go diff --git a/components/inputs/input_bio.templ b/ui/inputs/input_bio.templ similarity index 100% rename from components/inputs/input_bio.templ rename to ui/inputs/input_bio.templ diff --git a/components/inputs/input_bio_templ.go b/ui/inputs/input_bio_templ.go similarity index 91% rename from components/inputs/input_bio_templ.go rename to ui/inputs/input_bio_templ.go index 863bf17..72725ef 100644 --- a/components/inputs/input_bio_templ.go +++ b/ui/inputs/input_bio_templ.go @@ -36,7 +36,7 @@ func InputBio(value string, helpText string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/inputs/input_bio.templ`, Line: 4, Col: 141} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/inputs/input_bio.templ`, Line: 4, Col: 141} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -49,7 +49,7 @@ func InputBio(value string, helpText string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(helpText) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/inputs/input_bio.templ`, Line: 4, Col: 164} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/inputs/input_bio.templ`, Line: 4, Col: 164} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/ui/inputs/input_handle.templ b/ui/inputs/input_handle.templ new file mode 100644 index 0000000..3427c11 --- /dev/null +++ b/ui/inputs/input_handle.templ @@ -0,0 +1,34 @@ +package inputs + +templ HandleInitial() { +
    + + + + +
    +
    +} + +templ HandleError(value string, helpText string) { + + +
    + +
    +
    + +
    +
    +
    +} + +templ HandleSuccess(value string) { + + +
    + +
    +
    +
    +} diff --git a/components/inputs/input_handle_templ.go b/ui/inputs/input_handle_templ.go similarity index 78% rename from components/inputs/input_handle_templ.go rename to ui/inputs/input_handle_templ.go index f2b1cb6..927c897 100644 --- a/components/inputs/input_handle_templ.go +++ b/ui/inputs/input_handle_templ.go @@ -29,7 +29,7 @@ func HandleInitial() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -58,14 +58,14 @@ func HandleError(value string, helpText string) templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "User Handle User Handle + { children... } - { title } + { title } } diff --git a/ui/layout_templ.go b/ui/layout_templ.go index 4fd38ea..560aa36 100644 --- a/ui/layout_templ.go +++ b/ui/layout_templ.go @@ -251,7 +251,7 @@ func NavLogo(title string) templ.Component { templ_7745c5c3_Var10 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -259,14 +259,14 @@ func NavLogo(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/layout.templ`, Line: 39, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/layout.templ`, Line: 39, Col: 48} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { diff --git a/components/menus/assets_dropdown.templ b/ui/menus/assets_dropdown.templ similarity index 100% rename from components/menus/assets_dropdown.templ rename to ui/menus/assets_dropdown.templ diff --git a/components/menus/assets_dropdown_templ.go b/ui/menus/assets_dropdown_templ.go similarity index 100% rename from components/menus/assets_dropdown_templ.go rename to ui/menus/assets_dropdown_templ.go diff --git a/components/menus/coins_dropdown.templ b/ui/menus/coins_dropdown.templ similarity index 100% rename from components/menus/coins_dropdown.templ rename to ui/menus/coins_dropdown.templ diff --git a/components/menus/coins_dropdown_templ.go b/ui/menus/coins_dropdown_templ.go similarity index 91% rename from components/menus/coins_dropdown_templ.go rename to ui/menus/coins_dropdown_templ.go index fcd08d6..8d02864 100644 --- a/components/menus/coins_dropdown_templ.go +++ b/ui/menus/coins_dropdown_templ.go @@ -99,7 +99,7 @@ func CoinOption(a CoinInfo) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/menus/coins_dropdown.templ`, Line: 55, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/menus/coins_dropdown.templ`, Line: 55, Col: 29} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -112,7 +112,7 @@ func CoinOption(a CoinInfo) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/menus/coins_dropdown.templ`, Line: 56, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/menus/coins_dropdown.templ`, Line: 56, Col: 41} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -125,7 +125,7 @@ func CoinOption(a CoinInfo) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/menus/coins_dropdown.templ`, Line: 57, Col: 11} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/menus/coins_dropdown.templ`, Line: 57, Col: 11} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -143,7 +143,7 @@ func CoinOption(a CoinInfo) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/menus/coins_dropdown.templ`, Line: 61, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/menus/coins_dropdown.templ`, Line: 61, Col: 29} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -156,7 +156,7 @@ func CoinOption(a CoinInfo) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/menus/coins_dropdown.templ`, Line: 62, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/menus/coins_dropdown.templ`, Line: 62, Col: 41} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -169,7 +169,7 @@ func CoinOption(a CoinInfo) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/menus/coins_dropdown.templ`, Line: 63, Col: 11} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `ui/menus/coins_dropdown.templ`, Line: 63, Col: 11} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { diff --git a/ui/views/console.templ b/ui/views/console.templ new file mode 100644 index 0000000..48ff660 --- /dev/null +++ b/ui/views/console.templ @@ -0,0 +1,53 @@ +package views + +import ( + "github.com/sonr-io/motr/ui" + "github.com/sonr-io/motr/ui/app/helia" + "time" +) + +var heliaCardScriptHandle = templ.NewOnceHandle() + +func ConsoleView(d time.Time) templ.Component { + return consoleComponent(d) +} + +templ consoleComponent(d time.Time) { + @ui.HTML() { + @ui.Head() { + } + + @ui.Nav() { + @ui.NavLeft() { + @ui.NavLogo("Sonr") { +
    + +
    + } + } + @ui.NavRight() { + Time + } + } + @ui.Body() { + + @ui.Container() { +
    +
    + @helia.StatusCard() + @helia.NodeIDCard() + @helia.DiscoveredPeersCard() + @helia.ConnectedPeersCard() +
    +
    + @helia.ConnectedPeersList() + @helia.RunningLog() +
    + @helia.ScriptTag() +
    + } +
    + } +
    + } +} diff --git a/components/views/console_templ.go b/ui/views/console_templ.go similarity index 71% rename from components/views/console_templ.go rename to ui/views/console_templ.go index eefbd54..e5281d3 100644 --- a/components/views/console_templ.go +++ b/ui/views/console_templ.go @@ -9,18 +9,18 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/sonr-io/motr/components/dashboard" "github.com/sonr-io/motr/ui" + "github.com/sonr-io/motr/ui/app/helia" "time" ) var heliaCardScriptHandle = templ.NewOnceHandle() -func DemoView(d time.Time) templ.Component { - return demoComponent(d) +func ConsoleView(d time.Time) templ.Component { + return consoleComponent(d) } -func demoComponent(d time.Time) templ.Component { +func consoleComponent(d time.Time) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -99,113 +99,7 @@ func demoComponent(d time.Time) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = ui.NavLogo("Motr").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = ui.NavLeft().Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "Time") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = ui.NavRight().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) - templ_7745c5c3_Err = ui.Nav().Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var8 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = dashboard.HeliaStatusCard().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = dashboard.HeliaNodeIDCard().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = dashboard.HeliaDiscoveredPeersCard().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = dashboard.HeliaConnectedPeersCard().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = dashboard.HeliaConnectedPeersList().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = dashboard.HeliaRunningLog().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var9 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -217,13 +111,119 @@ func demoComponent(d time.Time) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = heliaCardScriptHandle.Once().Render(templ.WithChildren(ctx, templ_7745c5c3_Var9), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = ui.NavLogo("Sonr").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = ui.NavLeft().Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "Time") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = ui.NavRight().Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = ui.Nav().Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var8 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var9 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = helia.StatusCard().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = helia.NodeIDCard().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = helia.DiscoveredPeersCard().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = helia.ConnectedPeersCard().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = helia.ConnectedPeersList().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = helia.RunningLog().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = helia.ScriptTag().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -233,7 +233,7 @@ func demoComponent(d time.Time) templ.Component { } return nil }) - templ_7745c5c3_Err = ui.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = ui.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var9), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -243,7 +243,7 @@ func demoComponent(d time.Time) templ.Component { } return nil }) - templ_7745c5c3_Err = ui.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = ui.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/ui/views/home.templ b/ui/views/home.templ new file mode 100644 index 0000000..6c4e053 --- /dev/null +++ b/ui/views/home.templ @@ -0,0 +1,72 @@ +package views + +import ( + "github.com/sonr-io/motr/sink" + "github.com/sonr-io/motr/ui" + "github.com/sonr-io/motr/ui/inputs" +) + +var meta = sink.DefaultMetadata() + +func HomeView() templ.Component { + return homeComponent() +} + +templ homeComponent() { + @ui.HTML() { + @ui.Head() { + @ui.MetaComponent(meta) + } + @ui.Nav() { + @ui.NavLeft() { + + } + @ui.NavRight() { + + + Connected + + } + } + @ui.Body() { + @ui.Container() { + +
    + } + } + } +} diff --git a/components/views/home_templ.go b/ui/views/home_templ.go similarity index 78% rename from components/views/home_templ.go rename to ui/views/home_templ.go index 8b54226..90654e2 100644 --- a/components/views/home_templ.go +++ b/ui/views/home_templ.go @@ -11,6 +11,7 @@ import templruntime "github.com/a-h/templ/runtime" import ( "github.com/sonr-io/motr/sink" "github.com/sonr-io/motr/ui" + "github.com/sonr-io/motr/ui/inputs" ) var meta = sink.DefaultMetadata() @@ -74,7 +75,7 @@ func homeComponent() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -102,7 +103,7 @@ func homeComponent() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = ui.NavLogo("Motr").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -112,7 +113,7 @@ func homeComponent() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -128,6 +129,10 @@ func homeComponent() templ.Component { }() } ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " Connected") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } return nil }) templ_7745c5c3_Err = ui.NavRight().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) @@ -140,6 +145,10 @@ func homeComponent() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -164,7 +173,15 @@ func homeComponent() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "

    Welcome to Motr

    This is a demo of the Motr web app.

    You can use this app to manage your Motr account.

    Register
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "

    CREATE A SONR IDENTITY

    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = inputs.HandleInitial().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
    Claim Handle
    By signing up you agree to our Terms of Service and Privacy Policy
    Already have an account? Login
    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -180,10 +197,6 @@ func homeComponent() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } return nil }) templ_7745c5c3_Err = ui.HTML().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) diff --git a/ui/views/login.templ b/ui/views/login.templ new file mode 100644 index 0000000..5c2c178 --- /dev/null +++ b/ui/views/login.templ @@ -0,0 +1,24 @@ +package views + +import "github.com/sonr-io/motr/ui" + +templ LoginView() { + @ui.HTML() { + @ui.Head() { + @ui.MetaComponent(meta) + } + @ui.Nav() { + @ui.NavLeft() { + @ui.NavLogo("Sonr") { +
    + +
    + } + } + @ui.NavRight() { + } + } + @ui.Body() { + } + } +} diff --git a/components/views/login_templ.go b/ui/views/login_templ.go similarity index 82% rename from components/views/login_templ.go rename to ui/views/login_templ.go index c8c89cb..0777128 100644 --- a/components/views/login_templ.go +++ b/ui/views/login_templ.go @@ -8,9 +8,7 @@ package views import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -import ( - "github.com/sonr-io/motr/ui" -) +import "github.com/sonr-io/motr/ui" func LoginView() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { @@ -67,7 +65,7 @@ func LoginView() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -95,7 +93,25 @@ func LoginView() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = ui.NavLogo("Motr").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = ui.NavLogo("Sonr").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -105,11 +121,11 @@ func LoginView() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -123,7 +139,7 @@ func LoginView() templ.Component { ctx = templ.InitializeContext(ctx) return nil }) - templ_7745c5c3_Err = ui.NavRight().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = ui.NavRight().Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -133,7 +149,11 @@ func LoginView() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var8 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -147,11 +167,7 @@ func LoginView() templ.Component { ctx = templ.InitializeContext(ctx) return nil }) - templ_7745c5c3_Err = ui.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
    ") + templ_7745c5c3_Err = ui.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/ui/views/register.templ b/ui/views/register.templ new file mode 100644 index 0000000..0955ee3 --- /dev/null +++ b/ui/views/register.templ @@ -0,0 +1,30 @@ +package views + +import ( + "github.com/sonr-io/motr/ui" + "github.com/sonr-io/motr/ui/inputs" +) + +templ RegisterView() { + @ui.HTML() { + @ui.Head() { + @ui.MetaComponent(meta) + } + @ui.Nav() { + @ui.NavLeft() { + @ui.NavLogo("Sonr") { +
    + +
    + } + } + @ui.NavRight() { + } + } + @ui.Body() { + @ui.Container() { + @inputs.HandleInitial() + } + } + } +} diff --git a/components/views/register_templ.go b/ui/views/register_templ.go similarity index 83% rename from components/views/register_templ.go rename to ui/views/register_templ.go index 76904af..9e77106 100644 --- a/components/views/register_templ.go +++ b/ui/views/register_templ.go @@ -9,8 +9,8 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/sonr-io/motr/components/inputs" "github.com/sonr-io/motr/ui" + "github.com/sonr-io/motr/ui/inputs" ) func RegisterView() templ.Component { @@ -68,7 +68,7 @@ func RegisterView() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -96,7 +96,25 @@ func RegisterView() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = ui.NavLogo("Motr").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = ui.NavLogo("Sonr").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -106,11 +124,11 @@ func RegisterView() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -124,7 +142,7 @@ func RegisterView() templ.Component { ctx = templ.InitializeContext(ctx) return nil }) - templ_7745c5c3_Err = ui.NavRight().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = ui.NavRight().Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -134,7 +152,11 @@ func RegisterView() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var8 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -146,7 +168,7 @@ func RegisterView() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var8 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var9 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -164,17 +186,13 @@ func RegisterView() templ.Component { } return nil }) - templ_7745c5c3_Err = ui.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = ui.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var9), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) - templ_7745c5c3_Err = ui.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
    ") + templ_7745c5c3_Err = ui.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }