Compare commits
No commits in common. "39dfac77a9015781f67fa4db5388ca68f4994b84" and "4347f9632cbb3f1223de945adeaa10995716041f" have entirely different histories.
39dfac77a9
...
4347f9632c
3
dev.toml
3
dev.toml
@ -1,5 +1,2 @@
|
|||||||
[Server]
|
[Server]
|
||||||
Port = 1234
|
Port = 1234
|
||||||
|
|
||||||
[Template]
|
|
||||||
ActiveCard = "stores"
|
|
||||||
|
@ -70,6 +70,10 @@ body {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#stores {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
background-color: rgba(255, 255, 255, 0.5);
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
width: 10em;
|
width: 10em;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
<input id="search-input" name="{{ .SearchInputName }}" type="text" class="grid-item" class="search" placeholder="{{ .SearchPlaceholder }}" autocomplete="off" />
|
<input id="search-input" name="{{ .SearchInputName }}" type="text" class="grid-item" class="search" placeholder="{{ .SearchPlaceholder }}" autocomplete="off" />
|
||||||
|
|
||||||
{{ if eq .ActiveCard "stores" }}
|
|
||||||
<div class="cards" id="stores">
|
<div class="cards" id="stores">
|
||||||
{{range $Store := .Stores }}
|
{{range $Store := .Stores }}
|
||||||
<a target="_blank" href="{{ $Store.Url }}" class="card">
|
<a target="_blank" href="{{ $Store.Url }}" class="card">
|
||||||
@ -24,9 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if eq .ActiveCard "listings" }}
|
|
||||||
<div class="cards" id="listings">
|
<div class="cards" id="listings">
|
||||||
{{range $Listing := .Listings }}
|
{{range $Listing := .Listings }}
|
||||||
<a target="_blank" href="{{ $Listing.Url }}" class="card {{ if $Listing.InStock }}in-stock{{ end }}">
|
<a target="_blank" href="{{ $Listing.Url }}" class="card {{ if $Listing.InStock }}in-stock{{ end }}">
|
||||||
@ -35,7 +32,6 @@
|
|||||||
</a>
|
</a>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -13,14 +13,6 @@ import (
|
|||||||
"github.com/pelletier/go-toml"
|
"github.com/pelletier/go-toml"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ActiveCard string
|
|
||||||
|
|
||||||
const (
|
|
||||||
DiyHrtStores ActiveCard = "stores"
|
|
||||||
DiyHrtListings ActiveCard = "listings"
|
|
||||||
Websites ActiveCard = "websites"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
Port int
|
Port int
|
||||||
}
|
}
|
||||||
@ -39,18 +31,14 @@ type TemplateConfig struct {
|
|||||||
|
|
||||||
Listings []diyhrt.Listing
|
Listings []diyhrt.Listing
|
||||||
Stores []diyhrt.Store
|
Stores []diyhrt.Store
|
||||||
|
|
||||||
ActiveCard ActiveCard
|
|
||||||
|
|
||||||
Websites []Website
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct{
|
||||||
Server ServerConfig
|
Server ServerConfig
|
||||||
Template TemplateConfig
|
Template TemplateConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfig() Config {
|
func NewConfig() Config{
|
||||||
return Config{
|
return Config{
|
||||||
Server: ServerConfig{
|
Server: ServerConfig{
|
||||||
Port: 5500,
|
Port: 5500,
|
||||||
@ -72,8 +60,6 @@ func NewConfig() Config {
|
|||||||
SearchFormAction: "https://duckduckgo.com/",
|
SearchFormAction: "https://duckduckgo.com/",
|
||||||
SearchInputName: "q",
|
SearchInputName: "q",
|
||||||
|
|
||||||
ActiveCard: DiyHrtListings,
|
|
||||||
|
|
||||||
StoreFilter: diyhrt.StoreFilter{
|
StoreFilter: diyhrt.StoreFilter{
|
||||||
Limit: 0,
|
Limit: 0,
|
||||||
IncludeIds: []int{7},
|
IncludeIds: []int{7},
|
||||||
@ -82,10 +68,6 @@ func NewConfig() Config {
|
|||||||
ListingFilter: diyhrt.ListingFilter{
|
ListingFilter: diyhrt.ListingFilter{
|
||||||
FromStores: []int{7},
|
FromStores: []int{7},
|
||||||
},
|
},
|
||||||
|
|
||||||
Websites: []Website{
|
|
||||||
{Url: "https://gitea.elara.ws/Hazel/transfem-startpage", Name: "Transfem Startpage", ImageUrl: "https://gitea.elara.ws/assets/img/logo.svg"},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +83,7 @@ func (rc *TemplateConfig) LoadDiyHrt(listings []diyhrt.Listing) {
|
|||||||
rc.Stores = rc.StoreFilter.Filter(slices.Collect(maps.Values(existingStores)))
|
rc.Stores = rc.StoreFilter.Filter(slices.Collect(maps.Values(existingStores)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (rc *Config) ScanForConfigFile(profile string) error {
|
func (rc *Config) ScanForConfigFile(profile string) error {
|
||||||
profileFile := profile + ".toml"
|
profileFile := profile + ".toml"
|
||||||
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
package rendering
|
|
||||||
|
|
||||||
type Website struct {
|
|
||||||
Url string
|
|
||||||
Name string
|
|
||||||
ImageUrl string
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user