Skip to content

Commit

Permalink
Add hash to svg logo
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Jul 18, 2024
1 parent 0a6ed12 commit dbe6dee
Show file tree
Hide file tree
Showing 38 changed files with 38 additions and 47 deletions.
11 changes: 1 addition & 10 deletions glot_core/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,12 @@ impl FromStr for Language {
pub struct Config {
pub id: Language,
pub name: String,
pub logo_name: String,
pub logo_svg_path: String,
pub file_extension: String,
pub editor_config: EditorConfig,
pub run_config: RunConfig,
}

impl Config {
pub fn svg_icon_path(&self) -> String {
format!(
"/static/assets/language/{}.svg?hash=checksum",
self.logo_name
)
}
}

#[derive(Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EditorConfig {
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn config() -> Config {
Config {
id: Language::Assembly,
name: "Assembly".to_string(),
logo_name: "generic".to_string(),
logo_svg_path: "/static/assets/language/generic.svg?hash=checksum".to_string(),
file_extension: "asm".to_string(),
editor_config: EditorConfig {
default_filename: "main.asm".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/ats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn config() -> Config {
Config {
id: Language::Ats,
name: "ATS".to_string(),
logo_name: "ats".to_string(),
logo_svg_path: "/static/assets/language/ats.svg?hash=checksum".to_string(),
file_extension: "dats".to_string(),
editor_config: EditorConfig {
default_filename: "main.dats".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Bash,
name: "Bash".to_string(),
logo_name: "bash".to_string(),
logo_svg_path: "/static/assets/language/bash.svg?hash=checksum".to_string(),
file_extension: "sh".to_string(),
editor_config: EditorConfig {
default_filename: "main.sh".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn config() -> Config {
Config {
id: Language::C,
name: "C".to_string(),
logo_name: "c".to_string(),
logo_svg_path: "/static/assets/language/c.svg?hash=checksum".to_string(),
file_extension: "c".to_string(),
editor_config: EditorConfig {
default_filename: "main.c".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/clisp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Clisp,
name: "Common Lisp".to_string(),
logo_name: "clisp".to_string(),
logo_svg_path: "/static/assets/language/clisp.svg?hash=checksum".to_string(),
file_extension: "lsp".to_string(),
editor_config: EditorConfig {
default_filename: "main.lsp".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/clojure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Clojure,
name: "Clojure".to_string(),
logo_name: "clojure".to_string(),
logo_svg_path: "/static/assets/language/clojure.svg?hash=checksum".to_string(),
file_extension: "clj".to_string(),
editor_config: EditorConfig {
default_filename: "main.clj".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/cobol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn config() -> Config {
Config {
id: Language::Cobol,
name: "Cobol".to_string(),
logo_name: "generic".to_string(),
logo_svg_path: "/static/assets/language/generic.svg?hash=checksum".to_string(),
file_extension: "cob".to_string(),
editor_config: EditorConfig {
default_filename: "main.cob".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/coffeescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::CoffeeScript,
name: "CoffeeScript".to_string(),
logo_name: "coffeescript".to_string(),
logo_svg_path: "/static/assets/language/coffeescript.svg?hash=checksum".to_string(),
file_extension: "coffee".to_string(),
editor_config: EditorConfig {
default_filename: "main.coffee".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn config() -> Config {
Config {
id: Language::Cpp,
name: "C++".to_string(),
logo_name: "cpp".to_string(),
logo_svg_path: "/static/assets/language/cpp.svg?hash=checksum".to_string(),
file_extension: "cpp".to_string(),
editor_config: EditorConfig {
default_filename: "main.cpp".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/crystal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Crystal,
name: "Crystal".to_string(),
logo_name: "crystal".to_string(),
logo_svg_path: "/static/assets/language/crystal.svg?hash=checksum".to_string(),
file_extension: "cr".to_string(),
editor_config: EditorConfig {
default_filename: "main.cr".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/csharp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn config() -> Config {
Config {
id: Language::Csharp,
name: "C#".to_string(),
logo_name: "csharp".to_string(),
logo_svg_path: "/static/assets/language/csharp.svg?hash=checksum".to_string(),
file_extension: "cs".to_string(),
editor_config: EditorConfig {
default_filename: "main.cs".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn config() -> Config {
Config {
id: Language::D,
name: "D".to_string(),
logo_name: "d".to_string(),
logo_svg_path: "/static/assets/language/d.svg?hash=checksum".to_string(),
file_extension: "d".to_string(),
editor_config: EditorConfig {
default_filename: "main.d".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/dart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn config() -> Config {
Config {
id: Language::Dart,
name: "Dart".to_string(),
logo_name: "dart".to_string(),
logo_svg_path: "/static/assets/language/dart.svg?hash=checksum".to_string(),
file_extension: "dart".to_string(),
editor_config: EditorConfig {
default_filename: "main.dart".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/elixir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn config() -> Config {
Config {
id: Language::Elixir,
name: "Elixir".to_string(),
logo_name: "elixir".to_string(),
logo_svg_path: "/static/assets/language/elixir.svg?hash=checksum".to_string(),
file_extension: "ex".to_string(),
editor_config: EditorConfig {
default_filename: "main.ex".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/elm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn config() -> Config {
Config {
id: Language::Elm,
name: "Elm".to_string(),
logo_name: "elm".to_string(),
logo_svg_path: "/static/assets/language/elm.svg?hash=checksum".to_string(),
file_extension: "elm".to_string(),
editor_config: EditorConfig {
default_filename: "main.elm".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/erlang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn config() -> Config {
Config {
id: Language::Erlang,
name: "Erlang".to_string(),
logo_name: "erlang".to_string(),
logo_svg_path: "/static/assets/language/erlang.svg?hash=checksum".to_string(),
file_extension: "erl".to_string(),
editor_config: EditorConfig {
default_filename: "main.erl".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/fsharp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn config() -> Config {
Config {
id: Language::Fsharp,
name: "F#".to_string(),
logo_name: "fsharp".to_string(),
logo_svg_path: "/static/assets/language/fsharp.svg?hash=checksum".to_string(),
file_extension: "fs".to_string(),
editor_config: EditorConfig {
default_filename: "main.fs".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/go.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn config() -> Config {
Config {
id: Language::Go,
name: "Go".to_string(),
logo_name: "go".to_string(),
logo_svg_path: "/static/assets/language/go.svg?hash=checksum".to_string(),
file_extension: "go".to_string(),
editor_config: EditorConfig {
default_filename: "main.go".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/groovy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Groovy,
name: "Groovy".to_string(),
logo_name: "groovy".to_string(),
logo_svg_path: "/static/assets/language/groovy.svg?hash=checksum".to_string(),
file_extension: "groovy".to_string(),
editor_config: EditorConfig {
default_filename: "main.groovy".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/guile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Guile,
name: "Guile".to_string(),
logo_name: "guile".to_string(),
logo_svg_path: "/static/assets/language/guile.svg?hash=checksum".to_string(),
file_extension: "scm".to_string(),
editor_config: EditorConfig {
default_filename: "main.scm".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/hare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn config() -> Config {
Config {
id: Language::Guile,
name: "Hare".to_string(),
logo_name: "hare".to_string(),
logo_svg_path: "/static/assets/language/hare.svg?hash=checksum".to_string(),
file_extension: "ha".to_string(),
editor_config: EditorConfig {
default_filename: "main.ha".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/haskell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Haskell,
name: "Haskell".to_string(),
logo_name: "haskell".to_string(),
logo_svg_path: "/static/assets/language/haskell.svg?hash=checksum".to_string(),
file_extension: "hs".to_string(),
editor_config: EditorConfig {
default_filename: "main.hs".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/idris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn config() -> Config {
Config {
id: Language::Idris,
name: "Idris".to_string(),
logo_name: "idris".to_string(),
logo_svg_path: "/static/assets/language/idris.svg?hash=checksum".to_string(),
file_extension: "idr".to_string(),
editor_config: EditorConfig {
default_filename: "main.idr".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn config() -> Config {
Config {
id: Language::Java,
name: "Java".to_string(),
logo_name: "java".to_string(),
logo_svg_path: "/static/assets/language/java.svg?hash=checksum".to_string(),
file_extension: "java".to_string(),
editor_config: EditorConfig {
default_filename: "main.java".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/javascript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::JavaScript,
name: "JavaScript".to_string(),
logo_name: "javascript".to_string(),
logo_svg_path: "/static/assets/language/javascript.svg?hash=checksum".to_string(),
file_extension: "js".to_string(),
editor_config: EditorConfig {
default_filename: "main.js".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/julia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Julia,
name: "Julia".to_string(),
logo_name: "julia".to_string(),
logo_svg_path: "/static/assets/language/julia.svg?hash=checksum".to_string(),
file_extension: "jl".to_string(),
editor_config: EditorConfig {
default_filename: "main.jl".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/kotlin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn config() -> Config {
Config {
id: Language::Julia,
name: "Kotlin".to_string(),
logo_name: "kotlin".to_string(),
logo_svg_path: "/static/assets/language/kotlin.svg?hash=checksum".to_string(),
file_extension: "kt".to_string(),
editor_config: EditorConfig {
default_filename: "main.kt".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Lua,
name: "Lua".to_string(),
logo_name: "lua".to_string(),
logo_svg_path: "/static/assets/language/lua.svg?hash=checksum".to_string(),
file_extension: "lua".to_string(),
editor_config: EditorConfig {
default_filename: "main.lua".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/mercury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn config() -> Config {
Config {
id: Language::Mercury,
name: "Mercury".to_string(),
logo_name: "mercury".to_string(),
logo_svg_path: "/static/assets/language/mercury.svg?hash=checksum".to_string(),
file_extension: "m".to_string(),
editor_config: EditorConfig {
default_filename: "main.m".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/nim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Nim,
name: "Nim".to_string(),
logo_name: "nim".to_string(),
logo_svg_path: "/static/assets/language/nim.svg?hash=checksum".to_string(),
file_extension: "nim".to_string(),
editor_config: EditorConfig {
default_filename: "main.nim".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/nix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn config() -> Config {
Config {
id: Language::Nix,
name: "Nix".to_string(),
logo_name: "nix".to_string(),
logo_svg_path: "/static/assets/language/nix.svg?hash=checksum".to_string(),
file_extension: "nix".to_string(),
editor_config: EditorConfig {
default_filename: "main.nix".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/ocaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn config() -> Config {
Config {
id: Language::Ocaml,
name: "Ocaml".to_string(),
logo_name: "ocaml".to_string(),
logo_svg_path: "/static/assets/language/ocaml.svg?hash=checksum".to_string(),
file_extension: "ml".to_string(),
editor_config: EditorConfig {
default_filename: "main.ml".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/pascal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn config() -> Config {
Config {
id: Language::Pascal,
name: "Pascal".to_string(),
logo_name: "pascal".to_string(),
logo_svg_path: "/static/assets/language/pascal.svg?hash=checksum".to_string(),
file_extension: "pp".to_string(),
editor_config: EditorConfig {
default_filename: "main.pp".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/perl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Perl,
name: "Perl".to_string(),
logo_name: "perl".to_string(),
logo_svg_path: "/static/assets/language/perl.svg?hash=checksum".to_string(),
file_extension: "pl".to_string(),
editor_config: EditorConfig {
default_filename: "main.pl".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/php.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn config() -> Config {
Config {
id: Language::Php,
name: "PHP".to_string(),
logo_name: "php".to_string(),
logo_svg_path: "/static/assets/language/php.svg?hash=checksum".to_string(),
file_extension: "php".to_string(),
editor_config: EditorConfig {
default_filename: "main.php".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/language/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn config() -> Config {
Config {
id: Language::Python,
name: "Python".to_string(),
logo_name: "python".to_string(),
logo_svg_path: "/static/assets/language/python.svg?hash=checksum".to_string(),
file_extension: "py".to_string(),
editor_config: EditorConfig {
default_filename: "main.py".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion glot_core/src/page/home_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn view_content(model: &Model) -> Markup {
fn to_grid_language(language: &language::Config) -> language_grid::Language {
language_grid::Language {
name: language.name.clone(),
icon_path: language.svg_icon_path(),
icon_path: language.logo_svg_path.to_string(),
route: Route::NewSnippet(language.id.clone()),
}
}

0 comments on commit dbe6dee

Please sign in to comment.