remove github stuf
This commit is contained in:
parent
8341310684
commit
7f7367a34d
11 changed files with 61 additions and 80 deletions
14
.github/dependabot.yml
vendored
14
.github/dependabot.yml
vendored
|
@ -1,14 +0,0 @@
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "cargo"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "monthly"
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "monthly"
|
|
||||||
- package-ecosystem: "docker"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "monthly"
|
|
|
@ -35,19 +35,19 @@ button {
|
||||||
|
|
||||||
/* styles for the index page */
|
/* styles for the index page */
|
||||||
|
|
||||||
.search-container {
|
.search_container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
gap: 5rem;
|
gap: 5rem;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-container svg {
|
.search_container svg {
|
||||||
color: var(--logo-color);
|
color: var(--logo-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-container div {
|
.search_container div {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,10 +102,10 @@ button {
|
||||||
}
|
}
|
||||||
|
|
||||||
.search_bar button img {
|
.search_bar button img {
|
||||||
position:absolute;
|
position: absolute;
|
||||||
left:50%;
|
left: 50%;
|
||||||
top:50%;
|
top: 50%;
|
||||||
transform:translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search_bar button:active {
|
.search_bar button:active {
|
||||||
|
@ -336,7 +336,7 @@ footer div {
|
||||||
.results_aggregated {
|
.results_aggregated {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin: 2rem 0;
|
margin: 2rem 0;
|
||||||
content-visibility: auto;
|
content-visibility: auto;
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ footer div {
|
||||||
font-size: 2.5rem;
|
font-size: 2.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings > h1 {
|
.settings>h1 {
|
||||||
margin-bottom: 4rem;
|
margin-bottom: 4rem;
|
||||||
margin-left: 2rem;
|
margin-left: 2rem;
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ footer div {
|
||||||
margin: 0.3rem 0 1rem;
|
margin: 0.3rem 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings > hr {
|
.settings>hr {
|
||||||
margin-left: 2rem;
|
margin-left: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,15 +796,15 @@ footer div {
|
||||||
transition: .2s;
|
transition: .2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:checked + .slider {
|
input:checked+.slider {
|
||||||
background-color: var(--color-three);
|
background-color: var(--color-three);
|
||||||
}
|
}
|
||||||
|
|
||||||
input:focus + .slider {
|
input:focus+.slider {
|
||||||
box-shadow: 0 0 1px var(--color-three);
|
box-shadow: 0 0 1px var(--color-three);
|
||||||
}
|
}
|
||||||
|
|
||||||
input:checked + .slider::before {
|
input:checked+.slider::before {
|
||||||
transform: translateX(2.6rem);
|
transform: translateX(2.6rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,7 +817,7 @@ input:checked + .slider::before {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (width <= 1136px) {
|
@media screen and (width <=1136px) {
|
||||||
.hero-text-container {
|
.hero-text-container {
|
||||||
width: unset;
|
width: unset;
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,7 @@ input:checked + .slider::before {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (width <= 706px) {
|
@media screen and (width <=706px) {
|
||||||
.about-container article .logo-container svg {
|
.about-container article .logo-container svg {
|
||||||
width: clamp(200px, 290px, 815px);
|
width: clamp(200px, 290px, 815px);
|
||||||
}
|
}
|
||||||
|
@ -851,7 +851,7 @@ input:checked + .slider::before {
|
||||||
.features {
|
.features {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-list {
|
.feature-list {
|
||||||
padding: 35px 0;
|
padding: 35px 0;
|
||||||
}
|
}
|
||||||
|
@ -859,4 +859,4 @@ input:checked + .slider::before {
|
||||||
.feature-card {
|
.feature-card {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ use serde::Deserialize;
|
||||||
pub struct SearchParams {
|
pub struct SearchParams {
|
||||||
/// It stores the search parameter option `q` (or query in simple words)
|
/// It stores the search parameter option `q` (or query in simple words)
|
||||||
/// of the search url.
|
/// of the search url.
|
||||||
pub q: Option<String>,
|
pub query: Option<String>,
|
||||||
/// It stores the search parameter `page` (or pageno in simple words)
|
/// It stores the search parameter `page` (or pageno in simple words)
|
||||||
/// of the search url.
|
/// of the search url.
|
||||||
pub page: Option<u32>,
|
pub page: Option<u32>,
|
||||||
|
|
|
@ -147,9 +147,7 @@ pub async fn aggregate(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut results: Vec<SearchResult> =
|
let results: Vec<SearchResult> = result_map.iter().map(|(_, value)| value.clone()).collect();
|
||||||
result_map.iter().map(|(_, value)| value.clone()).collect();
|
|
||||||
|
|
||||||
results.sort_by(|a, b| a.description.len().cmp(&b.description.len()));
|
|
||||||
Ok(SearchResults::new(results, &engine_errors_info))
|
Ok(SearchResults::new(results, &engine_errors_info))
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,14 @@ pub async fn search(
|
||||||
) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
||||||
let params = web::Query::<SearchParams>::from_query(req.query_string())?;
|
let params = web::Query::<SearchParams>::from_query(req.query_string())?;
|
||||||
|
|
||||||
if params.q.as_ref().is_some_and(|q| q.trim().is_empty()) || params.q.is_none() {
|
if params.query.as_ref().is_some_and(|q| q.trim().is_empty()) || params.query.is_none() {
|
||||||
|
log::info!("wha!");
|
||||||
return Ok(HttpResponse::TemporaryRedirect()
|
return Ok(HttpResponse::TemporaryRedirect()
|
||||||
.insert_header(("location", "/"))
|
.insert_header(("location", "/"))
|
||||||
.finish());
|
.finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
let query = params.q.as_ref().unwrap().trim();
|
let query = params.query.as_ref().unwrap().trim();
|
||||||
|
|
||||||
let cookie = req.cookie("appCookie");
|
let cookie = req.cookie("appCookie");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! A module that handles `bar` partial for the `search_bar` partial and the home/index/main page in the `crabbysearch` frontend.
|
//! A module that handles `bar` partial for the `search_bar` partial and the home/index/main page in the `crabbysearch` frontend.
|
||||||
|
|
||||||
use maud::{html, Markup, PreEscaped};
|
use maud::{html, Markup};
|
||||||
|
|
||||||
/// A functions that handles the html code for the bar for the `search_bar` partial and the
|
/// A functions that handles the html code for the bar for the `search_bar` partial and the
|
||||||
/// home/index/main page in the search engine frontend.
|
/// home/index/main page in the search engine frontend.
|
||||||
|
@ -12,15 +12,40 @@ use maud::{html, Markup, PreEscaped};
|
||||||
/// # Returns
|
/// # Returns
|
||||||
///
|
///
|
||||||
/// It returns the compiled html code for the search bar as a result.
|
/// It returns the compiled html code for the search bar as a result.
|
||||||
pub fn bar(query: &str) -> Markup {
|
pub fn bar(query: &str, engines: Vec<(&'static str, bool)>) -> Markup {
|
||||||
html!(
|
html!(
|
||||||
.search_container {
|
.search_container {
|
||||||
(PreEscaped("<div class=\"search_bar\">"))
|
|
||||||
form action="/search" method="get" {
|
form action="/search" method="get" {
|
||||||
input type="search" name="query" value=(query) placeholder="Type to search";
|
div class="search_bar" {
|
||||||
input type="hidden" name="page" value="0";
|
input type="search" name="query" value=(query) placeholder="Type to search";
|
||||||
button type="submit" {
|
input type="hidden" name="page" value="1";
|
||||||
img src="./images/magnifying_glass.svg" alt="Info icon for error box";
|
button type="submit" {
|
||||||
|
img src="./images/magnifying_glass.svg" alt="Info icon for error box";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div class="search_bar" {
|
||||||
|
.engine_selection {
|
||||||
|
@for (name, selected) in engines{
|
||||||
|
@if selected {
|
||||||
|
.toggle_btn{
|
||||||
|
span {(name)}
|
||||||
|
label class="switch"{
|
||||||
|
input type="checkbox" class="engine" checked;
|
||||||
|
span class="slider round"{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@else {
|
||||||
|
.toggle_btn {
|
||||||
|
(name)
|
||||||
|
label class="switch"{
|
||||||
|
input type="checkbox" class="engine";
|
||||||
|
span class="slider round"{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! A module that handles the header for all the pages in the `crabbysearch` frontend.
|
//! A module that handles the header for all the pages in the `crabbysearch` frontend.
|
||||||
|
|
||||||
use crate::templates::partials::navbar::navbar;
|
use maud::{html, Markup, DOCTYPE};
|
||||||
use maud::{html, Markup, PreEscaped, DOCTYPE};
|
|
||||||
|
|
||||||
/// A function that handles the html code for the header for all the pages in the search engine frontend.
|
/// A function that handles the html code for the header for all the pages in the search engine frontend.
|
||||||
///
|
///
|
||||||
|
@ -26,10 +25,8 @@ pub fn header() -> Markup {
|
||||||
link href=("static/themes/simple.css") rel="stylesheet" type="text/css";
|
link href=("static/themes/simple.css") rel="stylesheet" type="text/css";
|
||||||
}
|
}
|
||||||
|
|
||||||
(PreEscaped("<body onload=\"getClientSettings()\">"))
|
|
||||||
header{
|
header{
|
||||||
h1{a href="/"{"crabbysearch"}}
|
h1{a href="/"{"crabbysearch"}}
|
||||||
(navbar())
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,3 @@
|
||||||
pub mod bar;
|
pub mod bar;
|
||||||
pub mod footer;
|
pub mod footer;
|
||||||
pub mod header;
|
pub mod header;
|
||||||
pub mod navbar;
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
//! A module that handles `navbar` partial for the header partial in the `crabbysearch` frontend.
|
|
||||||
|
|
||||||
use maud::{html, Markup};
|
|
||||||
|
|
||||||
/// A functions that handles the html code for the header partial.
|
|
||||||
///
|
|
||||||
/// # Returns
|
|
||||||
///
|
|
||||||
/// It returns the compiled html code for the navbar as a result.
|
|
||||||
pub fn navbar() -> Markup {
|
|
||||||
html!(
|
|
||||||
nav{
|
|
||||||
ul{
|
|
||||||
li{a href="about"{"about"}}
|
|
||||||
li{a href="settings"{"settings"}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! A module that handles the view for the index/home/main page in the `crabbysearch` frontend.
|
//! A module that handles the view for the index/home/main page in the `crabbysearch` frontend.
|
||||||
|
|
||||||
use maud::{html, Markup, PreEscaped};
|
use maud::{html, Markup};
|
||||||
|
|
||||||
use crate::templates::partials::{bar::bar, footer::footer, header::header};
|
use crate::templates::partials::{bar::bar, footer::footer, header::header};
|
||||||
|
|
||||||
|
@ -15,13 +15,7 @@ use crate::templates::partials::{bar::bar, footer::footer, header::header};
|
||||||
///
|
///
|
||||||
/// It returns the compiled html markup code as a result.
|
/// It returns the compiled html markup code as a result.
|
||||||
pub fn index() -> Markup {
|
pub fn index() -> Markup {
|
||||||
html!(
|
html!((header())(bar(&String::default(), vec![("bing", true)]))(
|
||||||
(header())
|
footer()
|
||||||
main class="search-container"{
|
))
|
||||||
(bar(&String::default()))
|
|
||||||
(PreEscaped("</div>"))
|
|
||||||
}
|
|
||||||
script src="static/index.js"{}
|
|
||||||
(footer())
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub fn search(query: &str, search_results: &SearchResults) -> Markup {
|
||||||
html!(
|
html!(
|
||||||
(header())
|
(header())
|
||||||
main class="results"{
|
main class="results"{
|
||||||
(bar(query))
|
(bar(query, vec![("Bing", true)]))
|
||||||
.results_aggregated{
|
.results_aggregated{
|
||||||
@if !search_results.results.is_empty() {
|
@if !search_results.results.is_empty() {
|
||||||
@for result in search_results.results.iter(){
|
@for result in search_results.results.iter(){
|
||||||
|
|
Loading…
Add table
Reference in a new issue