-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: move setup guide to wiki * fix: associate cost to user rather than product * test: assert unknown uploads * feature: notification when file is not understood for #62 * tweak: don't notify for new audits * wip: split editor UI * ui: split editor ui * wip: split classes * wip: split percentage ui complete * wip: split percentage ui complete * test: update qa * asset: plus minus icons * feature: splits and profits in product table closes #105 closes #101 * style: splits list + editor * bug fix: profit sum * style: splits list border and margin * test: assertions for profit/balance * test: test profit calculations * ci: wip behat on github actions * wip: authwave * feature: login via authwave closes #119 * feature: refactor upload manager * build: use new releases on all repos * test: improve tests * feature: account name - new settings panel closes #121 --------- Co-authored-by: rjbirkin <[email protected]>
- Loading branch information
1 parent
44fdfd9
commit 78a693a
Showing
16 changed files
with
142 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
namespace SHIFT\Trackshift\Auth; | ||
|
||
class Settings { | ||
/** @var array<string, string> */ | ||
private array $kvp = []; | ||
|
||
public function set(string $key, string $value):void { | ||
$this->kvp[$key] = $value; | ||
} | ||
|
||
public function get(string $key):?string { | ||
return $this->kvp[$key] ?? null; | ||
} | ||
|
||
public function getKvp():array { | ||
return $this->kvp; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,7 @@ | |
<li> | ||
<a href="/account/splits/">Splits</a> | ||
</li> | ||
<li> | ||
<a href="/account/settings/">Settings</a> | ||
</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<form method="post"> | ||
<label> | ||
<span>Account name</span> | ||
<input name="account_name" data-bind:value="@name" /> | ||
</label> | ||
|
||
<div class="actions"> | ||
<button name="do" value="save">Save</button> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<account-tabs /> | ||
<user-settings /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
use Gt\Dom\HTMLDocument; | ||
use Gt\DomTemplate\Binder; | ||
use Gt\Input\Input; | ||
use SHIFT\Trackshift\Auth\Settings; | ||
use SHIFT\Trackshift\Auth\User; | ||
use SHIFT\Trackshift\Auth\UserRepository; | ||
|
||
function go(HTMLDocument $document, Binder $binder, Settings $settings):void { | ||
$kvp = $settings->getKvp(); | ||
|
||
foreach($document->querySelectorAll("user-settings form input") as $input) { | ||
if(isset($kvp[$input->name])) { | ||
$binder->bindKeyValue($input->name, $kvp[$input->name]); | ||
} | ||
} | ||
} | ||
|
||
function do_save(Input $input, User $user, UserRepository $userRepository, Settings $settings):void { | ||
foreach($input as $key => $value) { | ||
$settings->set($key, $value); | ||
} | ||
|
||
$userRepository->setUserSettings($user, $settings); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
<?php | ||
use Gt\DomTemplate\Binder; | ||
use SHIFT\Trackshift\Auth\Settings; | ||
use SHIFT\Trackshift\Auth\User; | ||
use SHIFT\Trackshift\Split\SplitRepository; | ||
|
||
function go( | ||
SplitRepository $splitRepository, | ||
User $user, | ||
Settings $settings, | ||
Binder $binder, | ||
):void { | ||
$splits = $splitRepository->getAll($user, true); | ||
$splits = $splitRepository->getAll($user, $settings->get("account_name") ?? "You"); | ||
$binder->bindList($splits); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
select | ||
key, | ||
value | ||
|
||
from | ||
Settings | ||
|
||
where | ||
userId = ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
delete from Settings | ||
where | ||
userId = ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
insert into Settings ( | ||
userId, | ||
key, | ||
value | ||
) | ||
values ( | ||
:userId, | ||
:key, | ||
:value | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
create table Settings ( | ||
`userId` text not null references User(id) on update cascade on delete cascade, | ||
key text not null, | ||
value text, | ||
primary key (userId, key) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
user-settings { | ||
@extend %o-container; | ||
|
||
form { | ||
@extend %d-form-fields; | ||
margin-top: 4rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters