-
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.
feat: Introduce demo mode, suitable for screenshot
Let's also update the screenshot, to include today's changes. The mocked storage was conceived because of the auto update GUI. At least it works, but it was a pain to discover after carefully trying to mock the data with Firefox' dev tools.
- Loading branch information
Showing
5 changed files
with
131 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package storage | ||
|
||
import ( | ||
_ "embed" | ||
"time" | ||
|
||
"github.com/chelmertz/elly/internal/types" | ||
_ "github.com/mattn/go-sqlite3" | ||
) | ||
|
||
type StorageDemo struct{} | ||
|
||
var _ Storage = (*StorageDemo)(nil) | ||
|
||
func NewStorageDemo() *StorageDemo { | ||
return &StorageDemo{} | ||
} | ||
|
||
func (s *StorageDemo) Prs() StoredState { | ||
prs := make([]types.ViewPr, 0) | ||
lastUpdated := time.Now().UTC() | ||
|
||
pr1 := types.ViewPr{ | ||
Url: "1", // points is calculated based on PR URL, must be unique | ||
ReviewStatus: "", | ||
Title: "feat: Scaffolding script for a new service", | ||
Author: "chelmertz", | ||
RepoName: "api", | ||
RepoOwner: "chelmertz", | ||
RepoUrl: "", | ||
IsDraft: false, | ||
LastUpdated: lastUpdated, | ||
LastPrCommenter: "", | ||
ThreadsActionable: 3, | ||
ThreadsWaiting: 2, | ||
Additions: 32, | ||
Deletions: 15, | ||
ReviewRequestedFromUsers: []string{}, | ||
Buried: false, | ||
} | ||
|
||
pr2 := types.ViewPr{ | ||
Url: "2", | ||
ReviewStatus: "", | ||
Title: "chore: update license", | ||
Author: "channy2011", | ||
RepoName: "infrastructure", | ||
RepoOwner: "chelmertz", | ||
RepoUrl: "", | ||
IsDraft: true, | ||
LastUpdated: lastUpdated, | ||
LastPrCommenter: "", | ||
ThreadsActionable: 0, | ||
ThreadsWaiting: 0, | ||
Additions: 32, | ||
Deletions: 15, | ||
ReviewRequestedFromUsers: []string{}, | ||
Buried: false, | ||
} | ||
|
||
pr3 := types.ViewPr{ | ||
Url: "3", | ||
ReviewStatus: "APPROVED", | ||
Title: "feature: add settings for maximum minutes of idling", | ||
Author: "bierden22", | ||
RepoName: "web", | ||
RepoOwner: "chelmertz", | ||
RepoUrl: "", | ||
IsDraft: true, | ||
LastUpdated: lastUpdated, | ||
LastPrCommenter: "", | ||
ThreadsActionable: 0, | ||
ThreadsWaiting: 0, | ||
Additions: 32, | ||
Deletions: 15, | ||
ReviewRequestedFromUsers: []string{}, | ||
Buried: false, | ||
} | ||
|
||
prs = append(prs, pr1, pr2, pr3) | ||
|
||
state := StoredState{ | ||
Prs: prs, | ||
LastFetched: time.Now().UTC(), | ||
} | ||
|
||
return state | ||
} | ||
|
||
func (s *StorageDemo) StoreRepoPrs(orderedPrs []types.ViewPr) error { | ||
return nil | ||
} | ||
|
||
func (s *StorageDemo) Bury(prUrl string) error { | ||
return nil | ||
} | ||
|
||
func (s *StorageDemo) Unbury(prUrl string) error { | ||
return nil | ||
} | ||
|
||
func (s *StorageDemo) GetPr(prUrl string) (Pr, error) { | ||
return Pr{}, nil | ||
} |
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