diff --git a/.DS_Store b/.DS_Store index 9f0e34f..fee2f4c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.dockerignore b/.dockerignore index b28b51f..dfb6eec 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,4 @@ -resources/inspiration -resources/src -resources/scraped +resources todo.txt .gitignore docker-compose.yml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 30cf57e..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Ignored default folder with query files -/queries/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index a55e7a1..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/go.imports.xml b/.idea/go.imports.xml deleted file mode 100644 index 644cdf0..0000000 --- a/.idea/go.imports.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 146ab09..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index c9ea9ff..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/piekarnikgosipl.iml b/.idea/piekarnikgosipl.iml deleted file mode 100644 index 5e764c4..0000000 --- a/.idea/piekarnikgosipl.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/templates/styles/base.css b/css/base.css similarity index 100% rename from templates/styles/base.css rename to css/base.css diff --git a/templates/styles/components.css b/css/components.css similarity index 100% rename from templates/styles/components.css rename to css/components.css diff --git a/templates/styles/home.css b/css/home.css similarity index 100% rename from templates/styles/home.css rename to css/home.css diff --git a/templates/styles/kawiarnia.css b/css/kawiarnia.css similarity index 100% rename from templates/styles/kawiarnia.css rename to css/kawiarnia.css diff --git a/templates/styles/layout.css b/css/layout.css similarity index 100% rename from templates/styles/layout.css rename to css/layout.css diff --git a/templates/styles/normalize.css b/css/normalize.css similarity index 100% rename from templates/styles/normalize.css rename to css/normalize.css diff --git a/templates/styles/portfolio.css b/css/portfolio.css similarity index 100% rename from templates/styles/portfolio.css rename to css/portfolio.css diff --git a/templates/styles/wyroby.css b/css/wyroby.css similarity index 100% rename from templates/styles/wyroby.css rename to css/wyroby.css diff --git a/templates/styles/wyroby_lody.css b/css/wyroby_lody.css similarity index 100% rename from templates/styles/wyroby_lody.css rename to css/wyroby_lody.css diff --git a/templates/styles/wyroby_slodkie_stoly.css b/css/wyroby_slodkie_stoly.css similarity index 100% rename from templates/styles/wyroby_slodkie_stoly.css rename to css/wyroby_slodkie_stoly.css diff --git a/templates/styles/wyroby_torty.css b/css/wyroby_torty.css similarity index 100% rename from templates/styles/wyroby_torty.css rename to css/wyroby_torty.css diff --git a/resources/cakes.go b/data/cakes.go similarity index 99% rename from resources/cakes.go rename to data/cakes.go index 636448d..cff1b92 100644 --- a/resources/cakes.go +++ b/data/cakes.go @@ -1,4 +1,4 @@ -package resources +package data import "piekarnikgosi/types" diff --git a/html/image.templ b/html/image.templ new file mode 100644 index 0000000..f187ca1 --- /dev/null +++ b/html/image.templ @@ -0,0 +1,29 @@ +package html + +import ( + "crypto/sha256" + "encoding/hex" + "log" + "piekarnikgosi/utils" +) + +func processFilename(input string) (src, dst string) { + src = "img/" + input + hash := sha256.Sum256([]byte(input)) + dst = "www/images/" + hex.EncodeToString(hash[:])[:16] + ".avif" + return src, dst +} + +func ProcessImage(fileName string) string { + dst, err := utils.CopyFile(processFilename(fileName)) + + if err != nil { + log.Fatal(err) + } + + return dst[4:] +} + +templ AvifImage(srcPath, alt string) { + { +} diff --git a/templates/image_templ.go b/html/image_templ.go similarity index 76% rename from templates/image_templ.go rename to html/image_templ.go index dd68706..9fb2ae8 100644 --- a/templates/image_templ.go +++ b/html/image_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.3.1020 -package templates +package html //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -11,47 +11,24 @@ import templruntime "github.com/a-h/templ/runtime" import ( "crypto/sha256" "encoding/hex" - "github.com/h2non/bimg" "log" - "os" + "piekarnikgosi/utils" ) func processFilename(input string) (src, dst string) { - src = "resources/images/" + input + src = "img/" + input hash := sha256.Sum256([]byte(input)) dst = "www/images/" + hex.EncodeToString(hash[:])[:16] + ".avif" return src, dst } -func convertToAvif(fileName string) string { - src, dst := processFilename(fileName) - - _, err := os.Stat(dst) - if err == nil { - return dst[4:] - } - - log.Printf("generating image: %s %s", src, dst) - - buffer, err := bimg.Read(src) - if err != nil { - log.Fatal(err) - } - - options := bimg.Options{ - Type: bimg.AVIF, - Quality: 85, - } - newImage, err := bimg.NewImage(buffer).Process(options) +func ProcessImage(fileName string) string { + dst, err := utils.CopyFile(processFilename(fileName)) if err != nil { log.Fatal(err) } - if err := bimg.Write(dst, newImage); err != nil { - log.Fatal(err) - } - return dst[4:] } @@ -81,9 +58,9 @@ func AvifImage(srcPath, alt string) templ.Component { return templ_7745c5c3_Err } var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.ResolveAttributeValue(convertToAvif(srcPath)) + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.ResolveAttributeValue(ProcessImage(srcPath)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/image.templ`, Line: 51, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `html/image.templ`, Line: 28, Col: 33} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2) if templ_7745c5c3_Err != nil { @@ -96,7 +73,7 @@ func AvifImage(srcPath, alt string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.ResolveAttributeValue(alt) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/image.templ`, Line: 51, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `html/image.templ`, Line: 28, Col: 45} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3) if templ_7745c5c3_Err != nil { diff --git a/templates/index.templ b/html/index.templ similarity index 99% rename from templates/index.templ rename to html/index.templ index d534966..de45fd4 100644 --- a/templates/index.templ +++ b/html/index.templ @@ -1,4 +1,4 @@ -package templates +package html templ Index() { @layout("index") { diff --git a/templates/index_templ.go b/html/index_templ.go similarity index 99% rename from templates/index_templ.go rename to html/index_templ.go index 1d8f113..0e89146 100644 --- a/templates/index_templ.go +++ b/html/index_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.3.1020 -package templates +package html //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/templates/kawiarnia.templ b/html/kawiarnia.templ similarity index 99% rename from templates/kawiarnia.templ rename to html/kawiarnia.templ index 940527c..d8fde69 100644 --- a/templates/kawiarnia.templ +++ b/html/kawiarnia.templ @@ -1,4 +1,4 @@ -package templates +package html templ Kawiarnia() { @layout("kawiarnia") { diff --git a/templates/kawiarnia_templ.go b/html/kawiarnia_templ.go similarity index 99% rename from templates/kawiarnia_templ.go rename to html/kawiarnia_templ.go index 484494a..de18a7b 100644 --- a/templates/kawiarnia_templ.go +++ b/html/kawiarnia_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.3.1020 -package templates +package html //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/templates/layout.templ b/html/layout.templ similarity index 98% rename from templates/layout.templ rename to html/layout.templ index 2a0bedb..91dbaeb 100644 --- a/templates/layout.templ +++ b/html/layout.templ @@ -1,4 +1,4 @@ -package templates +package html import "fmt" @@ -11,13 +11,13 @@ templ layout(activePage string) { - +