From 359f1f52fd85abd32e2187394e8717b54f6c62ab Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sat, 14 Sep 2024 00:07:47 +1000 Subject: [PATCH 01/12] added makefile for simple development --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2b846c0 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +.ONESHELL: +.PHONY: all step1 step2 step3 + +tailwind-watch: + npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch + +templ-watch: + templ generate --watch + +air: + air + +all: + ${MAKE} -j3 tailwind-watch templ-watch air + From 3ac40c08c26aa6e7b73f13b896dcb44842c0a6df Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sat, 14 Sep 2024 00:19:22 +1000 Subject: [PATCH 02/12] More additions to make file and Makefile reference in README --- Makefile | 7 ++++++- README.md | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2b846c0..f318f41 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,11 @@ templ-watch: air: air -all: +watch: ${MAKE} -j3 tailwind-watch templ-watch air +upclient-generate: + openapi-generator-cli generate -i openapi.json -g go -o ./datafetcher/upclient --additional-properties packageName=upclient --git-user-id esteanes --git-repo-id expense-manager/datafetcher/upclient + +build: + templ generate && gofmt -s -w . && go mod tidy && go build -o expense-manager diff --git a/README.md b/README.md index 3d5d184..ea94092 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,26 @@ endpoitns to drive the UI ## How to develop +### Automatically +Most of the comands have been simplified down to a really simple make file + +Doing active development, run: +```bash +make watch +``` +as this will create a hot-reloading environment which will automatically update CSS, Templ generated HTML and Go logic while editing. + +If you need to regenerate the upbank API client run: +``` +make upclient-generate +``` + +If you want to generate a hard executable file then run: +``` +make build +``` + +### Manually 1. Install the OpenAPI generator `brew install openapi-generator` 2. Fetch the open-api definition JSON file From 7ae239305f2ef5a2ab4ef72e40fe27f46e7ab043 Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sat, 14 Sep 2024 09:15:46 +1000 Subject: [PATCH 03/12] cleaning up readme --- Makefile | 2 -- README.md | 25 +++++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index f318f41..141386a 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,11 @@ tailwind-watch: npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch - templ-watch: templ generate --watch air: air - watch: ${MAKE} -j3 tailwind-watch templ-watch air diff --git a/README.md b/README.md index ea94092..f0e958c 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,22 @@ endpoitns to drive the UI ## How to develop +### Dependencies +1. Install the OpenAPI generator +`sudo npm install openapi-generator` +2. Install Templ and air +* [Air](https://github.com/air-verse/air?tab=readme-ov-file#installation) +* [Templ](https://templ.guide/quick-start/installation) +3. Install Tailwind CSS +Install using npm as we're already using NPM for the API client generation. +[Tailwind Installation](https://tailwindcss.com/docs/installation) +4. Fetch the open-api definition JSON file +`curl https://raw.githubusercontent.com/up-banking/api/master/v1/openapi.json` +5. Make sure that you've set your up bank token in the environment variables in your `.bashrc` or `.zshrc` file - typically located at `~/.rc` +[Get your token from Up Bank](https://api.up.com.au/getting_started) +``` +export UP_BANK_TOKEN='' +``` ### Automatically Most of the comands have been simplified down to a really simple make file @@ -59,10 +75,6 @@ make build ``` ### Manually -1. Install the OpenAPI generator -`brew install openapi-generator` -2. Fetch the open-api definition JSON file -`curl https://raw.githubusercontent.com/up-banking/api/master/v1/openapi.json` 3. Generate the REST client code ``` openapi-generator-cli generate -i openapi.json -g go -o ./datafetcher/upclient --additional-properties packageName=upclient --git-user-id esteanes --git-repo-id expense-manager/datafetcher/upclient @@ -88,10 +100,7 @@ This will stop the generator from generating those files (which will mess up the 5. Fix up any import changes `go mod tidy` -6. Make sure that you've set your up bank token in the environment variables in your `.bashrc` or `.zshrc` file - typically located at `~/.rc` -``` -export UP_BANK_TOKEN='' -``` + 6. Build an executable ``` go build -o expense-manager.exe #windows From 9d386eea196141f98014d9be5585b61bee0420c7 Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sat, 14 Sep 2024 09:18:26 +1000 Subject: [PATCH 04/12] cleaning up readme --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f0e958c..31ecf62 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ make build ``` ### Manually -3. Generate the REST client code +1. Generate the REST client code ``` openapi-generator-cli generate -i openapi.json -g go -o ./datafetcher/upclient --additional-properties packageName=upclient --git-user-id esteanes --git-repo-id expense-manager/datafetcher/upclient ``` @@ -89,25 +89,25 @@ LICENSE ``` This will stop the generator from generating those files (which will mess up the Go compilation) -4. Generate the TEMPL components +1. Generate the TEMPL components `templ generate` * Note if you're finding it hard to run `templ`, it might be because `$GOPATH` is not on your `$PATH` so your computer can't find the executable. In that case either update your path or run `./$GOPATH/templ` -4. Format code +1. Format code `gofmt -s -w .` -5. Fix up any import changes +1. Fix up any import changes `go mod tidy` -6. Build an executable +1. Build an executable ``` go build -o expense-manager.exe #windows go build -o expense-manager #linux ``` -7. Run the executable +1. Run the executable ``` .\expense-manager.exe #windows ./expense-manager #linux From 518c680a71c15efee425df412723da161a93521f Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sat, 14 Sep 2024 09:19:52 +1000 Subject: [PATCH 05/12] cleaning up readme --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 31ecf62..a388e5f 100644 --- a/README.md +++ b/README.md @@ -103,14 +103,12 @@ This will stop the generator from generating those files (which will mess up the 1. Build an executable ``` -go build -o expense-manager.exe #windows -go build -o expense-manager #linux +go build -o expense-manager ``` 1. Run the executable ``` -.\expense-manager.exe #windows -./expense-manager #linux +./expense-manager ``` ## Helpful Commands From dfe91ff7941bec6583265e0a2e142928e07f2c48 Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sat, 14 Sep 2024 09:21:59 +1000 Subject: [PATCH 06/12] cleaning up readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a388e5f..6279d0d 100644 --- a/README.md +++ b/README.md @@ -89,24 +89,24 @@ LICENSE ``` This will stop the generator from generating those files (which will mess up the Go compilation) -1. Generate the TEMPL components +2. Generate the TEMPL components `templ generate` * Note if you're finding it hard to run `templ`, it might be because `$GOPATH` is not on your `$PATH` so your computer can't find the executable. In that case either update your path or run `./$GOPATH/templ` -1. Format code +3. Format code `gofmt -s -w .` -1. Fix up any import changes +4. Fix up any import changes `go mod tidy` -1. Build an executable +5. Build an executable ``` go build -o expense-manager ``` -1. Run the executable +6. Run the executable ``` ./expense-manager ``` From aa8553e9993d094cb3c0e7ed1e760782e3c27136 Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sat, 14 Sep 2024 13:22:11 +1000 Subject: [PATCH 07/12] changes to go files? --- .gitignore | 4 +++ Makefile | 1 - datafetcher/templates/accounts_templ.go | 38 ++++++++++---------- datafetcher/templates/accounts_templ.txt | 19 ---------- datafetcher/templates/components_templ.go | 14 ++++---- datafetcher/templates/components_templ.txt | 7 ---- datafetcher/templates/transactions_templ.go | 26 +++++++------- datafetcher/templates/transactions_templ.txt | 13 ------- 8 files changed, 43 insertions(+), 79 deletions(-) delete mode 100644 datafetcher/templates/accounts_templ.txt delete mode 100644 datafetcher/templates/components_templ.txt delete mode 100644 datafetcher/templates/transactions_templ.txt diff --git a/.gitignore b/.gitignore index c0e6526..59c7ba2 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ go.work # esteanes 20240929 - expense manager executable expense-manager +# node related files and directories +node_modules/ +package-lock.json +package.json diff --git a/Makefile b/Makefile index 141386a..b072c69 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ tailwind-watch: npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch templ-watch: templ generate --watch - air: air watch: diff --git a/datafetcher/templates/accounts_templ.go b/datafetcher/templates/accounts_templ.go index b3ae6c1..1c90d09 100644 --- a/datafetcher/templates/accounts_templ.go +++ b/datafetcher/templates/accounts_templ.go @@ -32,7 +32,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Accounts - Details

    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -49,7 +49,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -62,7 +62,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Account Type: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -75,7 +75,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Balance: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -88,7 +88,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -101,7 +101,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Created At: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -114,7 +114,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Id: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -127,7 +127,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("


    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -138,7 +138,7 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -164,7 +164,7 @@ func AccountButtons(accounts <-chan upclient.AccountResource) templ.Component { templ_7745c5c3_Var9 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Accounts

    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -181,7 +181,7 @@ func AccountButtons(accounts <-chan upclient.AccountResource) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -257,7 +257,7 @@ func AccountButtons(accounts <-chan upclient.AccountResource) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 17) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -283,7 +283,7 @@ func Accounts(accounts1 <-chan upclient.AccountResource, accounts2 <-chan upclie templ_7745c5c3_Var16 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Accounts") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -295,7 +295,7 @@ func Accounts(accounts1 <-chan upclient.AccountResource, accounts2 <-chan upclie if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 19) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/datafetcher/templates/accounts_templ.txt b/datafetcher/templates/accounts_templ.txt deleted file mode 100644 index bb7a64f..0000000 --- a/datafetcher/templates/accounts_templ.txt +++ /dev/null @@ -1,19 +0,0 @@ -

Accounts - Details

    -

    -

    Account Type: -

    Balance: - -

    Created At: -

    Id: -


    -
-

Accounts

    -
    -
-Accounts - diff --git a/datafetcher/templates/components_templ.go b/datafetcher/templates/components_templ.go index 79c0b53..6406894 100644 --- a/datafetcher/templates/components_templ.go +++ b/datafetcher/templates/components_templ.go @@ -31,7 +31,7 @@ func TimeComponent(d time.Time) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -44,7 +44,7 @@ func TimeComponent(d time.Time) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -70,7 +70,7 @@ func NotFoundComponent() templ.Component { templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
404 - Not found
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -96,7 +96,7 @@ func counts(global, user int) templ.Component { templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Global: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -109,7 +109,7 @@ func counts(global, user int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
User: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -122,7 +122,7 @@ func counts(global, user int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -148,7 +148,7 @@ func form() templ.Component { templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/datafetcher/templates/components_templ.txt b/datafetcher/templates/components_templ.txt deleted file mode 100644 index 9d519df..0000000 --- a/datafetcher/templates/components_templ.txt +++ /dev/null @@ -1,7 +0,0 @@ -
-
-
404 - Not found
-
Global: -
User: -
-
diff --git a/datafetcher/templates/transactions_templ.go b/datafetcher/templates/transactions_templ.go index d47a0db..94a33b2 100644 --- a/datafetcher/templates/transactions_templ.go +++ b/datafetcher/templates/transactions_templ.go @@ -65,7 +65,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Transactions

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -82,7 +82,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -197,7 +197,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Transaction AmountDescriptionStatusTimeMessageCategoryPurchase MethodCard Number
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -95,7 +95,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -108,7 +108,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -121,7 +121,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -134,7 +134,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -147,7 +147,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -160,7 +160,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -173,7 +173,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -186,7 +186,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -223,7 +223,7 @@ func Transactions(transactions chan upclient.TransactionResource, accounts chan templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Transactions") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -235,7 +235,7 @@ func Transactions(transactions chan upclient.TransactionResource, accounts chan if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/datafetcher/templates/transactions_templ.txt b/datafetcher/templates/transactions_templ.txt deleted file mode 100644 index 28e3879..0000000 --- a/datafetcher/templates/transactions_templ.txt +++ /dev/null @@ -1,13 +0,0 @@ -

Transactions

- -
Transaction AmountDescriptionStatusTimeMessageCategoryPurchase MethodCard Number
- - - - - - - -
-Transactions - From 2ac903a0b859dea8ee43615d126fb8be5237208b Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sun, 15 Sep 2024 16:04:11 +1000 Subject: [PATCH 08/12] refactoring templ files and prettifying --- .gitignore | 3 + datafetcher/functions/functions.go | 2 +- datafetcher/handlers/accounts.go | 8 +- datafetcher/handlers/transactions.go | 2 +- datafetcher/templates/accounts.templ | 69 ++-- datafetcher/templates/accounts_templ.go | 237 +++++------- datafetcher/templates/components_templ.go | 14 +- datafetcher/templates/transactions.templ | 189 ++++++--- datafetcher/templates/transactions_templ.go | 174 +++++++-- static/css/output.css | 409 +++++++++++++++++++- 10 files changed, 833 insertions(+), 274 deletions(-) diff --git a/.gitignore b/.gitignore index 59c7ba2..1fcb86a 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ expense-manager node_modules/ package-lock.json package.json + +# temporary directory which air uses +tmp/ diff --git a/datafetcher/functions/functions.go b/datafetcher/functions/functions.go index 25edad4..c9fcb69 100644 --- a/datafetcher/functions/functions.go +++ b/datafetcher/functions/functions.go @@ -2,5 +2,5 @@ package functions const ( AccountIdQueryParam = "accountId" - TransactionNumQueryParam = "numTransaction" + TransactionNumQueryParam = "numTransactions" ) diff --git a/datafetcher/handlers/accounts.go b/datafetcher/handlers/accounts.go index b2e53de..c68bc97 100644 --- a/datafetcher/handlers/accounts.go +++ b/datafetcher/handlers/accounts.go @@ -33,12 +33,12 @@ func (h *AccountHandler) Get(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html charset=utf-8") filterOwnershipType := upclient.OwnershipTypeEnum("INDIVIDUAL") accountChannel := make(chan upclient.AccountResource, 10) - clonedChannels := Clone(accountChannel, 2) - accountChannel1 := <-clonedChannels - accountChannel2 := <-clonedChannels + // clonedChannels := Clone(accountChannel, 2) + // accountChannel1 := <-clonedChannels + // accountChannel2 := <-clonedChannels go h.GetAccounts(accountChannel, filterOwnershipType) - templ.Handler(templates.Accounts(accountChannel1, accountChannel2), templ.WithStreaming()).ServeHTTP(w, r) + templ.Handler(templates.Accounts("Account Information", accountChannel, true), templ.WithStreaming()).ServeHTTP(w, r) } func (h *AccountHandler) GetAccounts(accountChannel chan upclient.AccountResource, ownershipType upclient.OwnershipTypeEnum) { diff --git a/datafetcher/handlers/transactions.go b/datafetcher/handlers/transactions.go index 8014af6..3d0f987 100644 --- a/datafetcher/handlers/transactions.go +++ b/datafetcher/handlers/transactions.go @@ -49,7 +49,7 @@ func (h *TransactionsHandler) Get(w http.ResponseWriter, r *http.Request) { } accountsChannel := make(chan upclient.AccountResource) go h.AccountHandler.GetAccounts(accountsChannel, upclient.OwnershipTypeEnum("INDIVIDUAL")) - templ.Handler(templates.Transactions(transactionsChannel, accountsChannel), templ.WithStreaming()).ServeHTTP(w, r) + templ.Handler(templates.Transactions("Transactions", transactionsChannel, accountsChannel, strconv.Itoa(int(numTransactions))), templ.WithStreaming()).ServeHTTP(w, r) } func (h *TransactionsHandler) getTransactionsForAllAccounts(transactionsChannel chan upclient.TransactionResource, numTransactions int32) { diff --git a/datafetcher/templates/accounts.templ b/datafetcher/templates/accounts.templ index 7317d89..542ba88 100644 --- a/datafetcher/templates/accounts.templ +++ b/datafetcher/templates/accounts.templ @@ -6,53 +6,38 @@ import ( "strings" ) -templ AccountDetails(accounts <-chan upclient.AccountResource) { -

Accounts - Details

-
    - for account := range accounts { - @templ.Flush() { -
    -

    { account.Attributes.DisplayName }

    -

    Account Type: { strings.ToTitle(string(account.Attributes.AccountType)) }

    -

    Balance: { account.Attributes.Balance.CurrencyCode } { account.Attributes.Balance.Value }

    -

    Created At: { account.Attributes.CreatedAt.String() }

    -

    Id: { account.Id }

    +templ AccountButtons(accounts <-chan upclient.AccountResource, isExtendedInfo bool) { + for account := range accounts { + @templ.Flush() { +
    + +
    +

    { account.Attributes.DisplayName }

    +

    Account Type: { strings.ToTitle(string(account.Attributes.AccountType)) }

    +

    Balance: { account.Attributes.Balance.CurrencyCode } { account.Attributes.Balance.Value }

    + if isExtendedInfo { +

    Id: { account.Id }

    +

    Created At: { account.Attributes.CreatedAt.String() }

    + }
    -
    - } +
    } -
+ } } -templ AccountButtons(accounts <-chan upclient.AccountResource) { -

Accounts

-
    -
    - -
    - for account := range accounts { - @templ.Flush() { -
    - -
    +templ AccountDetails(accounts <-chan upclient.AccountResource, isExtendedInfo bool) { +
    +
    +

    Accounts - Details

    + @GridOrganiser() { + @AccountButtons(accounts, isExtendedInfo) } - } -
+ + } -templ Accounts(accounts1 <-chan upclient.AccountResource, accounts2 <-chan upclient.AccountResource) { - - - - - - - - Accounts - - - @AccountButtons(accounts2) - @AccountDetails(accounts1) - - +templ Accounts(title string, accounts <-chan upclient.AccountResource, isExtendedInfo bool) { + @Base(title) { + @AccountDetails(accounts, isExtendedInfo) + } } diff --git a/datafetcher/templates/accounts_templ.go b/datafetcher/templates/accounts_templ.go index 1c90d09..696d9f1 100644 --- a/datafetcher/templates/accounts_templ.go +++ b/datafetcher/templates/accounts_templ.go @@ -14,7 +14,7 @@ import ( "strings" ) -func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { +func AccountButtons(accounts <-chan upclient.AccountResource, isExtendedInfo bool) 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 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -32,10 +32,6 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Accounts - Details

    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } for account := range accounts { 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 @@ -49,85 +45,121 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.DisplayName) + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(functions.AccountIdQueryParam) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 15, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 13, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Account Type: ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(strings.ToTitle(string(account.Attributes.AccountType))) + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(account.Id) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 16, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 13, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Balance: ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.Balance.CurrencyCode) + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.DisplayName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 17, Col: 58} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 15, Col: 84} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.Balance.Value) + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(strings.ToTitle(string(account.Attributes.AccountType))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 17, Col: 95} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 16, Col: 110} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Created At: ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.CreatedAt.String()) + templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.Balance.CurrencyCode) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 18, Col: 59} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 17, Col: 89} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

    Id: ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(account.Id) + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.Balance.Value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 19, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 17, Col: 126} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("


    ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if isExtendedInfo { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(account.Id) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 19, Col: 56} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var10 string + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.CreatedAt.String()) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 20, Col: 91} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -138,15 +170,11 @@ func AccountDetails(accounts <-chan upclient.AccountResource) templ.Component { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } return templ_7745c5c3_Err }) } -func AccountButtons(accounts <-chan upclient.AccountResource) templ.Component { +func AccountDetails(accounts <-chan upclient.AccountResource, isExtendedInfo bool) 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 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -159,105 +187,38 @@ func AccountButtons(accounts <-chan upclient.AccountResource) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var9 := templ.GetChildren(ctx) - if templ_7745c5c3_Var9 == nil { - templ_7745c5c3_Var9 = templ.NopComponent + templ_7745c5c3_Var11 := templ.GetChildren(ctx) + if templ_7745c5c3_Var11 == nil { + templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Accounts

    ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - for account := range accounts { - templ_7745c5c3_Var10 := 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 = templ_7745c5c3_Buffer.WriteString("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = templ.Flush().Render(templ.WithChildren(ctx, templ_7745c5c3_Var10), templ_7745c5c3_Buffer) + templ_7745c5c3_Var12 := 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 = AccountButtons(accounts, isExtendedInfo).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = GridOrganiser().Render(templ.WithChildren(ctx, templ_7745c5c3_Var12), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -265,7 +226,7 @@ func AccountButtons(accounts <-chan upclient.AccountResource) templ.Component { }) } -func Accounts(accounts1 <-chan upclient.AccountResource, accounts2 <-chan upclient.AccountResource) templ.Component { +func Accounts(title string, accounts <-chan upclient.AccountResource, isExtendedInfo bool) 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 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -278,24 +239,30 @@ func Accounts(accounts1 <-chan upclient.AccountResource, accounts2 <-chan upclie }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var16 := templ.GetChildren(ctx) - if templ_7745c5c3_Var16 == nil { - templ_7745c5c3_Var16 = templ.NopComponent + templ_7745c5c3_Var13 := templ.GetChildren(ctx) + if templ_7745c5c3_Var13 == nil { + templ_7745c5c3_Var13 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Accounts") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = AccountButtons(accounts2).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = AccountDetails(accounts1).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { + templ_7745c5c3_Var14 := 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 = AccountDetails(accounts, isExtendedInfo).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + }) + templ_7745c5c3_Err = Base(title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var14), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/datafetcher/templates/components_templ.go b/datafetcher/templates/components_templ.go index 6406894..79c0b53 100644 --- a/datafetcher/templates/components_templ.go +++ b/datafetcher/templates/components_templ.go @@ -31,7 +31,7 @@ func TimeComponent(d time.Time) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -44,7 +44,7 @@ func TimeComponent(d time.Time) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -70,7 +70,7 @@ func NotFoundComponent() templ.Component { templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
404 - Not found
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -96,7 +96,7 @@ func counts(global, user int) templ.Component { templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Global: ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -109,7 +109,7 @@ func counts(global, user int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
User: ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -122,7 +122,7 @@ func counts(global, user int) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -148,7 +148,7 @@ func form() templ.Component { templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/datafetcher/templates/transactions.templ b/datafetcher/templates/transactions.templ index 5230d7a..45e65a6 100644 --- a/datafetcher/templates/transactions.templ +++ b/datafetcher/templates/transactions.templ @@ -40,64 +40,141 @@ func getCategory(transaction upclient.TransactionResource) string { } templ TransactionsTable(transactions chan upclient.TransactionResource) { -

Transactions

- - - - - - - - - - - - - - - for transaction := range(transactions) { - @templ.Flush() { +
+

Transactions

+
+
Transaction AmountDescriptionStatusTimeMessageCategoryPurchase MethodCard Number
+ - - - - - - - - + + + + + + + + - } - } - -
{ transaction.Attributes.Amount.Value }{ transaction.Attributes.Description }{ string(transaction.Attributes.Status) }{ transaction.Attributes.CreatedAt.String() }{ getMessage(transaction) }{ getCategory(transaction) }{ getCardPurchase(transaction) }{ getCardPurchaseNumber(transaction) }Transaction AmountDescriptionStatusTimeMessageCategoryPurchase MethodCard Number
+ + + for transaction := range(transactions) { + @templ.Flush() { + + { transaction.Attributes.Amount.Value } + { transaction.Attributes.Description } + { string(transaction.Attributes.Status) } + { transaction.Attributes.CreatedAt.String() } + { getMessage(transaction) } + { getCategory(transaction) } + { getCardPurchase(transaction) } + { getCardPurchaseNumber(transaction) } + + } + } + + + + } -templ Transactions(transactions chan upclient.TransactionResource, accounts chan upclient.AccountResource) { - - - - - - Transactions - - - - @AccountButtons(accounts) - @TransactionsTable(transactions) - - +templ numTransactionSlider(numTransactions string) { +
+ + + + +
+ + +
+ + +
+ +} + +templ dateSelector() { +
+

Select Date Range

+
+ +
+ + +
+ +
+ + +
+
+ + +
+} + +templ Transactions(title string, transactions chan upclient.TransactionResource, accounts chan upclient.AccountResource, numTransactions string) { + @Base(title) { + @GridOrganiser() { + @AccountButtons(accounts, false) + @numTransactionSlider(numTransactions) + @dateSelector() + } + @TransactionsTable(transactions) + } } diff --git a/datafetcher/templates/transactions_templ.go b/datafetcher/templates/transactions_templ.go index 94a33b2..9fcffe7 100644 --- a/datafetcher/templates/transactions_templ.go +++ b/datafetcher/templates/transactions_templ.go @@ -65,7 +65,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Transactions

") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -82,111 +82,111 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -197,7 +197,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Transaction AmountDescriptionStatusTimeMessageCategoryPurchase MethodCard Number
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(transaction.Attributes.Amount.Value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 61, Col: 47} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 63, Col: 92} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(transaction.Attributes.Description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 62, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 64, Col: 91} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(string(transaction.Attributes.Status)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 63, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 65, Col: 94} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(transaction.Attributes.CreatedAt.String()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 64, Col: 53} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 66, Col: 98} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(getMessage(transaction)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 65, Col: 35} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 67, Col: 80} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(getCategory(transaction)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 66, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 68, Col: 81} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(getCardPurchase(transaction)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 67, Col: 40} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 69, Col: 85} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(getCardPurchaseNumber(transaction)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 68, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 70, Col: 91} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -205,7 +205,7 @@ func TransactionsTable(transactions chan upclient.TransactionResource) templ.Com }) } -func Transactions(transactions chan upclient.TransactionResource, accounts chan upclient.AccountResource) templ.Component { +func numTransactionSlider(numTransactions string) 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 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -223,19 +223,145 @@ func Transactions(transactions chan upclient.TransactionResource, accounts chan templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Transactions") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = AccountButtons(accounts).Render(ctx, templ_7745c5c3_Buffer) + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(numTransactions) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 84, Col: 77} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var13 string + templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(numTransactions) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 88, Col: 64} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 14) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = TransactionsTable(transactions).Render(ctx, templ_7745c5c3_Buffer) + return templ_7745c5c3_Err + }) +} + +func dateSelector() 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 + 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_Var14 := templ.GetChildren(ctx) + if templ_7745c5c3_Var14 == nil { + templ_7745c5c3_Var14 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 15) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + return templ_7745c5c3_Err + }) +} + +func Transactions(title string, transactions chan upclient.TransactionResource, accounts chan upclient.AccountResource, numTransactions string) 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 + 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_Var15 := templ.GetChildren(ctx) + if templ_7745c5c3_Var15 == nil { + templ_7745c5c3_Var15 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var16 := 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_Var17 := 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 = AccountButtons(accounts, false).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 16) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = numTransactionSlider(numTransactions).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 17) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = dateSelector().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = GridOrganiser().Render(templ.WithChildren(ctx, templ_7745c5c3_Var17), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = TransactionsTable(transactions).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = Base(title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var16), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/static/css/output.css b/static/css/output.css index 63fe86c..00a84ed 100644 --- a/static/css/output.css +++ b/static/css/output.css @@ -554,35 +554,339 @@ video { --tw-contain-style: ; } -.collapse { - visibility: collapse; +.container { + width: 100%; +} + +@media (min-width: 640px) { + .container { + max-width: 640px; + } +} + +@media (min-width: 768px) { + .container { + max-width: 768px; + } +} + +@media (min-width: 1024px) { + .container { + max-width: 1024px; + } +} + +@media (min-width: 1280px) { + .container { + max-width: 1280px; + } +} + +@media (min-width: 1536px) { + .container { + max-width: 1536px; + } } .static { position: static; } +.sticky { + position: sticky; +} + +.top-0 { + top: 0px; +} + +.mx-auto { + margin-left: auto; + margin-right: auto; +} + +.mb-2 { + margin-bottom: 0.5rem; +} + +.mb-4 { + margin-bottom: 1rem; +} + +.mb-6 { + margin-bottom: 1.5rem; +} + +.mb-8 { + margin-bottom: 2rem; +} + +.mt-4 { + margin-top: 1rem; +} + +.mt-6 { + margin-top: 1.5rem; +} + +.block { + display: block; +} + +.flex { + display: flex; +} + .table { display: table; } +.grid { + display: grid; +} + .contents { display: contents; } -.border-collapse { - border-collapse: collapse; +.hidden { + display: none; +} + +.h-2 { + height: 0.5rem; +} + +.h-full { + height: 100%; +} + +.max-h-96 { + max-height: 24rem; +} + +.min-h-screen { + min-height: 100vh; +} + +.w-32 { + width: 8rem; +} + +.w-full { + width: 100%; +} + +.min-w-full { + min-width: 100%; +} + +.max-w-2xl { + max-width: 42rem; +} + +.flex-auto { + flex: 1 1 auto; +} + +.table-auto { + table-layout: auto; +} + +.cursor-pointer { + cursor: pointer; +} + +.appearance-none { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.grid-cols-1 { + grid-template-columns: repeat(1, minmax(0, 1fr)); +} + +.flex-col { + flex-direction: column; +} + +.flex-wrap { + flex-wrap: wrap; +} + +.items-center { + align-items: center; +} + +.justify-center { + justify-content: center; +} + +.gap-8 { + gap: 2rem; +} + +.gap-4 { + gap: 1rem; +} + +.space-x-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.5rem * var(--tw-space-x-reverse)); + margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); +} + +.space-x-4 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(1rem * var(--tw-space-x-reverse)); + margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); +} + +.space-x-0 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0px * var(--tw-space-x-reverse)); + margin-left: calc(0px * calc(1 - var(--tw-space-x-reverse))); +} + +.space-y-4 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1rem * var(--tw-space-y-reverse)); +} + +.overflow-y-auto { + overflow-y: auto; +} + +.rounded-lg { + border-radius: 0.5rem; +} + +.rounded-md { + border-radius: 0.375rem; } .border { border-width: 1px; } +.border-b { + border-bottom-width: 1px; +} + +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity)); +} + +.border-gray-300 { + --tw-border-opacity: 1; + border-color: rgb(209 213 219 / var(--tw-border-opacity)); +} + +.bg-blue-500 { + --tw-bg-opacity: 1; + background-color: rgb(59 130 246 / var(--tw-bg-opacity)); +} + +.bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} + +.bg-gray-200 { + --tw-bg-opacity: 1; + background-color: rgb(229 231 235 / var(--tw-bg-opacity)); +} + +.bg-gray-300 { + --tw-bg-opacity: 1; + background-color: rgb(209 213 219 / var(--tw-bg-opacity)); +} + +.bg-gray-50 { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} + +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.bg-gradient-to-r { + background-image: linear-gradient(to right, var(--tw-gradient-stops)); +} + +.from-orange-50 { + --tw-gradient-from: #fff7ed var(--tw-gradient-from-position); + --tw-gradient-to: rgb(255 247 237 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.to-orange-200 { + --tw-gradient-to: #fed7aa var(--tw-gradient-to-position); +} + +.p-10 { + padding: 2.5rem; +} + +.p-2 { + padding: 0.5rem; +} + +.p-20 { + padding: 5rem; +} + +.p-6 { + padding: 1.5rem; +} + +.p-8 { + padding: 2rem; +} + +.px-4 { + padding-left: 1rem; + padding-right: 1rem; +} + +.px-6 { + padding-left: 1.5rem; + padding-right: 1.5rem; +} + +.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.text-left { + text-align: left; +} + +.text-center { + text-align: center; +} + .text-4xl { font-size: 2.25rem; line-height: 2.5rem; } +.text-lg { + font-size: 1.125rem; + line-height: 1.75rem; +} + +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + .text-xl { font-size: 1.25rem; line-height: 1.75rem; @@ -592,6 +896,103 @@ video { font-weight: 700; } +.font-medium { + font-weight: 500; +} + +.font-semibold { + font-weight: 600; +} + +.text-gray-600 { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity)); +} + +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.shadow-lg { + --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + .filter { filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); } + +.hover\:bg-blue-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); +} + +.hover\:bg-yellow-400:hover { + --tw-bg-opacity: 1; + background-color: rgb(250 204 21 / var(--tw-bg-opacity)); +} + +.focus\:border-blue-500:focus { + --tw-border-opacity: 1; + border-color: rgb(59 130 246 / var(--tw-border-opacity)); +} + +.focus\:outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus\:ring-2:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-blue-400:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(96 165 250 / var(--tw-ring-opacity)); +} + +.focus\:ring-blue-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); +} + +@media (min-width: 768px) { + .md\:w-auto { + width: auto; + } + + .md\:w-1\/2 { + width: 50%; + } + + .md\:grid-cols-2 { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .md\:space-x-4 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(1rem * var(--tw-space-x-reverse)); + margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); + } + + .md\:space-y-0 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0px * var(--tw-space-y-reverse)); + } +} + +@media (min-width: 1024px) { + .lg\:grid-cols-3 { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } +} From c5172ec512ed9bee25acfad02176d692a44dacb2 Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sun, 15 Sep 2024 16:04:35 +1000 Subject: [PATCH 09/12] adding base template and rendered HTML files --- datafetcher/templates/accounts_templ.txt | 13 +++ datafetcher/templates/base.templ | 23 +++++ datafetcher/templates/base_templ.go | 92 ++++++++++++++++++++ datafetcher/templates/base_templ.txt | 5 ++ datafetcher/templates/components_templ.txt | 7 ++ datafetcher/templates/transactions_templ.txt | 18 ++++ 6 files changed, 158 insertions(+) create mode 100644 datafetcher/templates/accounts_templ.txt create mode 100644 datafetcher/templates/base.templ create mode 100644 datafetcher/templates/base_templ.go create mode 100644 datafetcher/templates/base_templ.txt create mode 100644 datafetcher/templates/components_templ.txt create mode 100644 datafetcher/templates/transactions_templ.txt diff --git a/datafetcher/templates/accounts_templ.txt b/datafetcher/templates/accounts_templ.txt new file mode 100644 index 0000000..95a38e9 --- /dev/null +++ b/datafetcher/templates/accounts_templ.txt @@ -0,0 +1,13 @@ +

+

Account Type: +

Balance: + +

+

Id: +

Created At: +

+
+

Accounts - Details

+
diff --git a/datafetcher/templates/base.templ b/datafetcher/templates/base.templ new file mode 100644 index 0000000..50767e5 --- /dev/null +++ b/datafetcher/templates/base.templ @@ -0,0 +1,23 @@ +package templates + +templ Base(title string) { + + + + + + + + { title } + + + { children... } + + +} + +templ GridOrganiser() { +
    + { children... } +
+} diff --git a/datafetcher/templates/base_templ.go b/datafetcher/templates/base_templ.go new file mode 100644 index 0000000..49780b4 --- /dev/null +++ b/datafetcher/templates/base_templ.go @@ -0,0 +1,92 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.771 +package templates + +//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" + +func Base(title string) 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 + 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_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/base.templ`, Line: 11, Col: 17} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func GridOrganiser() 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 + 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_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ_7745c5c3_Var3.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/datafetcher/templates/base_templ.txt b/datafetcher/templates/base_templ.txt new file mode 100644 index 0000000..2c45e10 --- /dev/null +++ b/datafetcher/templates/base_templ.txt @@ -0,0 +1,5 @@ + + + +
    +
diff --git a/datafetcher/templates/components_templ.txt b/datafetcher/templates/components_templ.txt new file mode 100644 index 0000000..9d519df --- /dev/null +++ b/datafetcher/templates/components_templ.txt @@ -0,0 +1,7 @@ +
+
+
404 - Not found
+
Global: +
User: +
+
diff --git a/datafetcher/templates/transactions_templ.txt b/datafetcher/templates/transactions_templ.txt new file mode 100644 index 0000000..ce223cb --- /dev/null +++ b/datafetcher/templates/transactions_templ.txt @@ -0,0 +1,18 @@ +

Transactions

+ +
Transaction AmountDescriptionStatusTimeMessageCategoryPurchase MethodCard Number
+ + + + + + + +
+
+

Select Date Range

+ + + From 5c819adf1abfc1051aa096a75eb6bd631c341a5d Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sun, 15 Sep 2024 16:06:38 +1000 Subject: [PATCH 10/12] css change --- static/css/output.css | 44 ------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/static/css/output.css b/static/css/output.css index 00a84ed..84aed6d 100644 --- a/static/css/output.css +++ b/static/css/output.css @@ -685,10 +685,6 @@ video { max-width: 42rem; } -.flex-auto { - flex: 1 1 auto; -} - .table-auto { table-layout: auto; } @@ -711,10 +707,6 @@ video { flex-direction: column; } -.flex-wrap { - flex-wrap: wrap; -} - .items-center { align-items: center; } @@ -727,10 +719,6 @@ video { gap: 2rem; } -.gap-4 { - gap: 1rem; -} - .space-x-2 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(0.5rem * var(--tw-space-x-reverse)); @@ -743,18 +731,6 @@ video { margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); } -.space-x-0 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(0px * var(--tw-space-x-reverse)); - margin-left: calc(0px * calc(1 - var(--tw-space-x-reverse))); -} - -.space-y-4 > :not([hidden]) ~ :not([hidden]) { - --tw-space-y-reverse: 0; - margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse))); - margin-bottom: calc(1rem * var(--tw-space-y-reverse)); -} - .overflow-y-auto { overflow-y: auto; } @@ -966,29 +942,9 @@ video { } @media (min-width: 768px) { - .md\:w-auto { - width: auto; - } - - .md\:w-1\/2 { - width: 50%; - } - .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } - - .md\:space-x-4 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(1rem * var(--tw-space-x-reverse)); - margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); - } - - .md\:space-y-0 > :not([hidden]) ~ :not([hidden]) { - --tw-space-y-reverse: 0; - margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse))); - margin-bottom: calc(0px * var(--tw-space-y-reverse)); - } } @media (min-width: 1024px) { From 3a878cbe92718475fb15ac644796e64b4220880b Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sun, 15 Sep 2024 16:12:49 +1000 Subject: [PATCH 11/12] cleanup --- datafetcher/handlers/accounts.go | 7 +++---- datafetcher/handlers/transactions.go | 8 ++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/datafetcher/handlers/accounts.go b/datafetcher/handlers/accounts.go index c68bc97..fa02307 100644 --- a/datafetcher/handlers/accounts.go +++ b/datafetcher/handlers/accounts.go @@ -33,9 +33,6 @@ func (h *AccountHandler) Get(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html charset=utf-8") filterOwnershipType := upclient.OwnershipTypeEnum("INDIVIDUAL") accountChannel := make(chan upclient.AccountResource, 10) - // clonedChannels := Clone(accountChannel, 2) - // accountChannel1 := <-clonedChannels - // accountChannel2 := <-clonedChannels go h.GetAccounts(accountChannel, filterOwnershipType) templ.Handler(templates.Accounts("Account Information", accountChannel, true), templ.WithStreaming()).ServeHTTP(w, r) @@ -46,7 +43,9 @@ func (h *AccountHandler) GetAccounts(accountChannel chan upclient.AccountResourc resp, r2, err := h.UpClient.AccountsAPI.AccountsGet(h.UpAuth).PageSize(h.MaxPageSize).FilterOwnershipType(ownershipType).Execute() if err != nil { h.Log.Println(fmt.Sprintf("Error when calling `AccountsAPI.AccountsGet`: %s\n", err)) - h.Log.Println(fmt.Sprintf("Full HTTP response: %v\n", r2)) + if r2 != nil { + h.Log.Println(fmt.Sprintf("Full HTTP response: %v\n", r2)) + } h.Log.Println("Unable to get account information") } diff --git a/datafetcher/handlers/transactions.go b/datafetcher/handlers/transactions.go index 3d0f987..8aa4770 100644 --- a/datafetcher/handlers/transactions.go +++ b/datafetcher/handlers/transactions.go @@ -70,7 +70,9 @@ func (h *TransactionsHandler) getTransactionsForAllAccounts(transactionsChannel resp, r2, err := getRequest.Execute() if err != nil { h.Log.Println(fmt.Sprintf("Error when calling `TransactionsAPI.TransactionsGet``: %s\n", err)) - h.Log.Println(fmt.Sprintf("Full HTTP response: %s\n", r2.Body)) + if r2 != nil { + h.Log.Println(fmt.Sprintf("Full HTTP response: %s\n", r2.Body)) + } h.Log.Println(r2.Body) return } @@ -108,7 +110,9 @@ func (h *TransactionsHandler) getTransactionsForSpecifiedAccount(transactionsCha resp, r2, err := getRequest.Execute() if err != nil { h.Log.Println(fmt.Sprintf("Error when calling `TransactionsAPI.TransactionsGet``: %s\n", err)) - h.Log.Println(fmt.Sprintf("Full HTTP response: %s\n", r2.Body)) + if r2 != nil { + h.Log.Println(fmt.Sprintf("Full HTTP response: %s\n", r2.Body)) + } h.Log.Println(r2.Body) return } From 4fde743bb993276b3c99d82089201b459e336d89 Mon Sep 17 00:00:00 2001 From: Ellington Steanes <19161310+ESteanes@users.noreply.github.com> Date: Sun, 15 Sep 2024 16:23:48 +1000 Subject: [PATCH 12/12] cleanupV2 --- datafetcher/handlers/transactions.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/datafetcher/handlers/transactions.go b/datafetcher/handlers/transactions.go index 8aa4770..5316df3 100644 --- a/datafetcher/handlers/transactions.go +++ b/datafetcher/handlers/transactions.go @@ -73,7 +73,6 @@ func (h *TransactionsHandler) getTransactionsForAllAccounts(transactionsChannel if r2 != nil { h.Log.Println(fmt.Sprintf("Full HTTP response: %s\n", r2.Body)) } - h.Log.Println(r2.Body) return } pageAfter = resp.Links.Next.Get() @@ -113,7 +112,6 @@ func (h *TransactionsHandler) getTransactionsForSpecifiedAccount(transactionsCha if r2 != nil { h.Log.Println(fmt.Sprintf("Full HTTP response: %s\n", r2.Body)) } - h.Log.Println(r2.Body) return } pageAfter = resp.Links.Next.Get()