Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

voice search - minor changes

DanielŻuławskiaed9b2b6cf0c
diff --git a/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtml b/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtml
index cad4e9c33..cb1aadb99 100644
--- a/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtml
@@ -1,13 +1,16 @@
@model SearchBoxModel
@inject Grand.Domain.Blogs.BlogSettings blogSettings
-
+@inject IWorkContext workContext
+@{
+ var lang = workContext.WorkingLanguage.LanguageCulture;
+}
<template id="searchBoxContainer">
<a class="modal-close" @@click="$bvModal.hide('search-box')"><b-icon icon="x"></b-icon></a>
<form asp-route="ProductSearch" method="get" id="small-search-box-form" ref="searchForm" class="searchBox w-100">
<input type="hidden" asp-for="Box" value="true" />
<label for="small-searchterms" class="sr-only">@Loc["Search.SearchBox.Tooltip"]</label>
<div class="input-group flex-row">
- <input minlength="@(Model.SearchTermMinimumLength)" @if (Model.AutoCompleteEnabled) { <text> @@input="searchbox.autocompleteVue()" </text> } v-model="searchbox.text" type="search" name="q" ref="searchBoxInput" class="form-control search-box-text" id="small-searchterms" :placeholder="searchbox.placeholder">
+ <input minlength="@(Model.SearchTermMinimumLength)" maxlength="20" @if (Model.AutoCompleteEnabled) { <text> @@input="searchbox.autocompleteVue()" </text> } v-model="searchbox.text" type="search" name="q" ref="searchBoxInput" class="form-control search-box-text" id="small-searchterms" :placeholder="searchbox.placeholder">
@if (Model.AvailableCategories.Any())
{
<select asp-for="SearchCategoryId" asp-items="Model.AvailableCategories" class="search-box-select custom-select input-group-addon"></select>
@@ -15,7 +18,7 @@
@await Component.InvokeAsync("Widget", new { widgetZone = "searchbox_before_search_button" })
<div class="input-group-append">
- <button id="voiceSearchButton" @@touchstart="searchbox.recording = true" @@touchend="searchbox.recording = false" @@mousedown="searchbox.recording = true" @@mouseup="searchbox.recording = false" :data-title="searchbox.micMessage" ref="micBtn" type="button" v-bind:class="[{ focus: searchbox.recording }, 'btn btn-link']">
+ <button id="voiceSearchButton" @@touchstart="searchbox.recording = true" @@touchend="searchbox.recording = false" @@mousedown="searchbox.recording = true" @@mouseup="searchbox.recording = false" :data-title="searchbox.micMessage" ref="micBtn" type="button" v-bind:class="[{ focus: searchbox.recording }, 'btn btn-link']">
<template v-if="searchbox.recording">
<b-icon icon="mic" variant="info"></b-icon>
</template>
@@ -109,6 +112,7 @@
searchitems: null,
focus: false,
text: "",
+ lang: '@lang',
placeholder: "@Loc["Search.SearchBox.Tooltip"]",
micMessage: "Hold to Speak",
searchcategories: null,
@@ -190,7 +194,7 @@
const searchForm = vm.$refs.searchForm;
const searchBoxInput = vm.$refs.searchBoxInput;
recognition.continuous = true;
- recognition.lang = "en-US";
+ recognition.lang = searchbox.lang;
searchBoxInput.focus();
diff --git a/src/Web/Grand.Web/wwwroot/theme/css/common/common.css b/src/Web/Grand.Web/wwwroot/theme/css/common/common.css
index ad609d684..b305e762e 100644
--- a/src/Web/Grand.Web/wwwroot/theme/css/common/common.css
+++ b/src/Web/Grand.Web/wwwroot/theme/css/common/common.css
@@ -704,7 +704,6 @@ input:checked ~ .color-container .color::before {
height: 100%;
}
#search-box .modal-content,
-#search-box .input-group .search-box-select,
#search-box .input-group .search-box-button,
#search-box .input-group .modal-close {
border: 0;
@@ -726,6 +725,8 @@ input:checked ~ .color-container .color::before {
border-bottom: 2px solid #000;
border-radius: 0;
height: auto;
+ white-space: nowrap;
+ text-overflow: ellipsis;
}
#search-box .modal-body .search-box-text:focus {
box-shadow: none;
@@ -804,8 +805,15 @@ input:checked ~ .color-container .color::before {
display: block;
z-index: 3;
}
-.search-box-select {
- max-width: 100px;
+#search-box .search-box-select {
+ max-width: 130px;
+ font-size: 18px;
+ font-weight: 500;
+ box-shadow: none;
+ border: 0;
+ border-bottom: 2px solid #000;
+ border-radius: 0;
+ margin-left: 15px;
}
.advanced-search-results {
position: absolute;
@@ -1409,6 +1417,9 @@ footer .list-group-item span:last-child {
}
}
@media (max-width: 575px) {
+ #search-box .search-box-select {
+ max-width: 80px;
+ }
.quick-view .qv-title {
font-size: 18px;
}
diff --git a/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.css b/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.css
index e5b29414d..72b153d2d 100644
--- a/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.css
+++ b/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.css
@@ -790,7 +790,6 @@ input:checked ~ .color-container .color::before {
height: 100%;
}
#search-box .modal-content,
-#search-box .input-group .search-box-select,
#search-box .input-group .search-box-button,
#search-box .input-group .modal-close {
border: 0;
@@ -812,6 +811,8 @@ input:checked ~ .color-container .color::before {
border-bottom: 2px solid #000;
border-radius: 0;
height: auto;
+ white-space: nowrap;
+ text-overflow: ellipsis;
}
#search-box .modal-body .search-box-text:focus {
box-shadow: none;
@@ -890,8 +891,15 @@ input:checked ~ .color-container .color::before {
display: block;
z-index: 3;
}
-.search-box-select {
- max-width: 100px;
+#search-box .search-box-select {
+ max-width: 130px;
+ font-size: 18px;
+ font-weight: 500;
+ box-shadow: none;
+ border: 0;
+ border-bottom: 2px solid #000;
+ border-radius: 0;
+ margin-right: 15px;
}
.advanced-search-results {
position: absolute;
@@ -1505,6 +1513,9 @@ footer .list-group-item span:last-child {
}
}
@media (max-width: 575px) {
+ #search-box .search-box-select {
+ max-width: 80px;
+ }
.quick-view .qv-title {
font-size: 18px;
}