-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Guillaume Hivert <[email protected]>
- Loading branch information
Showing
9 changed files
with
147 additions
and
27 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,26 +1,21 @@ | ||
import data/decoders/search_result.{type SearchResult} | ||
import data/model/mock | ||
import gleam/result | ||
import data/decoders/search_result.{type SearchResults} | ||
|
||
pub type Model { | ||
Model(input: String, search_results: List(SearchResult)) | ||
Model(input: String, search_results: SearchResults) | ||
} | ||
|
||
pub fn init() { | ||
let search_results = | ||
mock.mock() | ||
|> result.unwrap([]) | ||
Model(input: "", search_results: search_results) | ||
Model(input: "", search_results: search_result.Start) | ||
} | ||
|
||
pub fn update_input(model: Model, content: String) { | ||
Model(..model, input: content) | ||
} | ||
|
||
pub fn update_search_results(model: Model, search_results: List(SearchResult)) { | ||
pub fn update_search_results(model: Model, search_results: SearchResults) { | ||
Model(..model, search_results: search_results) | ||
} | ||
|
||
pub fn reset(_model: Model) { | ||
Model(search_results: [], input: "") | ||
Model(search_results: search_result.Start, input: "") | ||
} |
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,10 +1,10 @@ | ||
import data/decoders/search_result.{type SearchResult} | ||
import data/decoders/search_result.{type SearchResults} | ||
import lustre_http as http | ||
|
||
pub type Msg { | ||
None | ||
SubmitSearch | ||
SearchResults(Result(List(SearchResult), http.HttpError)) | ||
SearchResults(Result(SearchResults, http.HttpError)) | ||
UpdateInput(String) | ||
Reset | ||
} |
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 @@ | ||
pub const gloogle_description = "Gloogle can search through all public gleam packages, to help you find the function you're looking for! Enter a type or a function name to get some results." | ||
|
||
pub const exact_match = "Matched directly from the signature of the functions, constants or types." | ||
|
||
pub const partial_match = "Partly matched from the signature of the functions, constants or types." | ||
|
||
pub const retry_query = "Retry with a different query. You can match functions, types or constants names, as well as functions types directly!" | ||
|
||
pub const internal_server_error = "Internal server error. The error should be fixed soon. Please, retry later." |
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