Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: troubleshooting page search #132

Merged
merged 16 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,5 +345,61 @@
"menu_troubleshooting.description": "Access the documentation for identifications, diagnostics and corrections for fails in the VTEX platform systems and products",
"sidebar_troubleshooting.title": "Troubleshooting",
"sidebar_troubleshooting.description": "Access the documentation for identifications, diagnostics and corrections for fails in the VTEX platform systems and products",
"troubleshooting_filter_module.title": "Module"
"troubleshooting_filter_tags.title": "Tags",
"troubleshooting_filter_tags.orders": "Orders",
"troubleshooting_filter_tags.integration": "Integration",
"troubleshooting_filter_tags.marketplace": "Marketplace",
"troubleshooting_filter_tags.mercado_livre": "Mercado Libre",
"troubleshooting_filter_tags.paused_offer": "Paused offer",
"troubleshooting_filter_tags.amazon": "Amazon",
"troubleshooting_filter_tags.sku": "SKU",
"troubleshooting_filter_tags.inventory": "Inventory",
"troubleshooting_filter_tags.pricing": "Pricing",
"troubleshooting_filter_tags.redirects": "Redirects",
"troubleshooting_filter_tags.master_data_v1": "Master Data v1",
"troubleshooting_filter_tags.customer": "Customer",
"troubleshooting_filter_tags.address": "Address",
"troubleshooting_filter_tags.multistore": "Multistore",
"troubleshooting_filter_tags.catalog": "Catalog",
"troubleshooting_filter_tags.spreadsheet": "Spreadsheet",
"troubleshooting_filter_tags.import": "Import",
"troubleshooting_filter_tags.b2b": "B2B",
"troubleshooting_filter_tags.schema": "Schema",
"troubleshooting_filter_tags.master_data": "Master Data",
"troubleshooting_filter_tags.spreadsheet_import": "Spreadsheet import",
"troubleshooting_filter_tags.index": "Index",
"troubleshooting_filter_tags.product": "Product",
"troubleshooting_filter_tags.trade_policy": "Trade policy",
"troubleshooting_filter_tags.message_center": "Message center",
"troubleshooting_filter_tags.email_templates": "Email templates",
"troubleshooting_filter_tags.authentication_token": "Authentication token",
"troubleshooting_filter_tags.ean": "EAN",
"troubleshooting_filter_tags.search": "Search",
"troubleshooting_filter_tags.intelligent_search": "Intelligent search",
"troubleshooting_filter_tags.rewriter": "Rewriter",
"troubleshooting_filter_tags.report": "Report",
"troubleshooting_filter_tags.export": "Export",
"troubleshooting_filter_tags.dashboard": "Dashboard",
"troubleshooting_filter_tags.vtex_admin": "VTEX Admin",
"troubleshooting_filter_tags.overview": "Overview",
"troubleshooting_filter_tags.user_roles": "User roles",
"troubleshooting_filter_tags.reservation": "Reservation",
"troubleshooting_filter_tags.xml_integration": "XML integration",
"troubleshooting_filter_tags.stock": "Stock",
"troubleshooting_filter_tags.order_status": "Order status",
"troubleshooting_filter_tags.invoice": "Invoice",
"troubleshooting_filter_tags.site_editor": "Site Editor",
"troubleshooting_filter_tags.cms": "CMS",
"troubleshooting_filter_tags.store_framework": "Store Framework",
"troubleshooting_filter_tags.promotions": "Promotions",
"troubleshooting_filter_tags.affiliate": "Affiliate",
"troubleshooting_filter_tags.request_headers": "Request headers",
"troubleshooting_filter_tags.utm": "UTM",
"troubleshooting_filter_tags.custom_javascript": "Custom javascript",
"troubleshooting_filter_tags.separate_deliveries": "Separate deliveries",
"troubleshooting_filter_tags.order_split": "Order split",
"troubleshooting_filter_tags.packages": "Packages",
"troubleshooting_filter_tags.shipping": "Shipping",
"troubleshooting_filter_tags.pre_sale": "Pre-sale",
"troubleshooting_page_search.placeholder": "Search for identifications, diagnostics and corrections for fails..."
}
58 changes: 57 additions & 1 deletion src/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,61 @@
"menu_troubleshooting.description": "Acceda a la documentación para identificaciones, diagnósticos y correcciones de fallas en los sistemas y productos de la plataforma VTEX",
"sidebar_troubleshooting.title": "Troubleshooting",
"sidebar_troubleshooting.description": "Acceda a la documentación para identificaciones, diagnósticos y correcciones de fallas en los sistemas y productos de la plataforma VTEX",
"troubleshooting_filter_module.title": "Módulo"
"troubleshooting_filter_tags.title": "Tags",
"troubleshooting_filter_tags.orders": "Pedidos",
"troubleshooting_filter_tags.integration": "Integración",
"troubleshooting_filter_tags.marketplace": "Marketplace",
"troubleshooting_filter_tags.amazon": "Amazon",
"troubleshooting_filter_tags.mercado_livre": "Mercado Libre",
"troubleshooting_filter_tags.paused_offer": "Anuncio pausado",
"troubleshooting_filter_tags.sku": "SKU",
"troubleshooting_filter_tags.inventory": "Inventory",
"troubleshooting_filter_tags.pricing": "Precios",
"troubleshooting_filter_tags.redirects": "Redirecciones",
"troubleshooting_filter_tags.master_data_v1": "Master Data v1",
"troubleshooting_filter_tags.customer": "Cliente",
"troubleshooting_filter_tags.address": "Direccion",
"troubleshooting_filter_tags.multistore": "Multitienda",
"troubleshooting_filter_tags.catalog": "Catalog",
"troubleshooting_filter_tags.spreadsheet": "Planilla",
"troubleshooting_filter_tags.import": "Importación",
"troubleshooting_filter_tags.b2b": "B2B",
"troubleshooting_filter_tags.schema": "Schema",
"troubleshooting_filter_tags.master_data": "Master Data",
"troubleshooting_filter_tags.spreadsheet_import": "Importación de plantillas",
"troubleshooting_filter_tags.index": "Indexación",
"troubleshooting_filter_tags.product": "Producto",
"troubleshooting_filter_tags.trade_policy": "Política comercial",
"troubleshooting_filter_tags.message_center": "Central de mensajes",
"troubleshooting_filter_tags.email_templates": "Plantillas de emails",
"troubleshooting_filter_tags.authentication_token": "Token de autenticación",
"troubleshooting_filter_tags.ean": "EAN",
"troubleshooting_filter_tags.search": "Búsqueda",
"troubleshooting_filter_tags.intelligent_search": "Intelligent search",
"troubleshooting_filter_tags.rewriter": "Rewriter",
"troubleshooting_filter_tags.report": "Informe",
"troubleshooting_filter_tags.export": "Exportación",
"troubleshooting_filter_tags.dashboard": "Dashboard",
"troubleshooting_filter_tags.vtex_admin": "VTEX Admin",
"troubleshooting_filter_tags.overview": "Vista general",
"troubleshooting_filter_tags.user_roles": "Rol de usuario",
"troubleshooting_filter_tags.reservation": "Reserva",
"troubleshooting_filter_tags.xml_integration": "Integración XML",
"troubleshooting_filter_tags.stock": "Stock",
"troubleshooting_filter_tags.order_status": "Status del pedido",
"troubleshooting_filter_tags.invoice": "Factura",
"troubleshooting_filter_tags.site_editor": "Site Editor",
"troubleshooting_filter_tags.cms": "CMS",
"troubleshooting_filter_tags.store_framework": "Store Framework",
"troubleshooting_filter_tags.promotions": "Promociones",
"troubleshooting_filter_tags.affiliate": "Afiliado",
"troubleshooting_filter_tags.request_headers": "Request headers",
"troubleshooting_filter_tags.utm": "UTM",
"troubleshooting_filter_tags.custom_javascript": "Javascript personalizado",
"troubleshooting_filter_tags.separate_deliveries": "Envíos separados",
"troubleshooting_filter_tags.order_split": "Split de pedidos",
"troubleshooting_filter_tags.packages": "Paquetes",
"troubleshooting_filter_tags.shipping": "Envío",
"troubleshooting_filter_tags.pre_sale": "Preventa",
"troubleshooting_page_search.placeholder": "Buscar por identificaciones, diagnósticos y correcciones de fallas..."
}
60 changes: 58 additions & 2 deletions src/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
"known_issues_filter_modules.title": "Módulos",
"known_issues_filter.all": "Todos",
"sort.label": "Ordenar por:",
"sort.recently_updated": "Recentemente atualizado",
"sort.recently_updated": "Atualizados recentemente",
"sort.newest": "Mais novos",
"known_issues_result.empty": "Nenhum resultado correspondente. Tente outros filtros.",
"known_issues_date.created": "Criado em",
Expand Down Expand Up @@ -363,5 +363,61 @@
"menu_troubleshooting.description": "Acesse a documentação para identificações, diagnósticos e correções de falhas nos sistemas e produtos da plataforma VTEX",
"sidebar_troubleshooting.title": "Troubleshooting",
"sidebar_troubleshooting.description": "Acesse a documentação para identificações, diagnósticos e correções de falhas nos sistemas e produtos da plataforma VTEX",
"troubleshooting_filter_module.title": "Módulo"
"troubleshooting_filter_tags.title": "Tags",
"troubleshooting_filter_tags.orders": "Pedidos",
"troubleshooting_filter_tags.integration": "Integração",
"troubleshooting_filter_tags.marketplace": "Marketplace",
"troubleshooting_filter_tags.mercado_livre": "Mercado Livre",
"troubleshooting_filter_tags.paused_offer": "Anúncio pausado",
"troubleshooting_filter_tags.amazon": "Amazon",
"troubleshooting_filter_tags.sku": "SKU",
"troubleshooting_filter_tags.inventory": "Inventário",
"troubleshooting_filter_tags.pricing": "Preços",
"troubleshooting_filter_tags.redirects": "Redirects",
"troubleshooting_filter_tags.master_data_v1": "Master Data v1",
"troubleshooting_filter_tags.customer": "Cliente",
"troubleshooting_filter_tags.address": "Endereço",
"troubleshooting_filter_tags.multistore": "Multiloja",
"troubleshooting_filter_tags.catalog": "Catálogo",
"troubleshooting_filter_tags.spreadsheet": "Planilha",
"troubleshooting_filter_tags.import": "Importação",
"troubleshooting_filter_tags.b2b": "B2B",
"troubleshooting_filter_tags.schema": "Schema",
"troubleshooting_filter_tags.master_data": "Master Data",
"troubleshooting_filter_tags.spreadsheet_import": "Importação de planilhas",
"troubleshooting_filter_tags.index": "Indexação",
"troubleshooting_filter_tags.product": "Produto",
"troubleshooting_filter_tags.trade_policy": "Política comercial",
"troubleshooting_filter_tags.message_center": "Central de mensagens",
"troubleshooting_filter_tags.email_templates": "Templates de emails",
"troubleshooting_filter_tags.authentication_token": "Token de autenticação",
"troubleshooting_filter_tags.ean": "EAN",
"troubleshooting_filter_tags.search": "Busca",
"troubleshooting_filter_tags.intelligent_search": "Intelligent search",
"troubleshooting_filter_tags.rewriter": "Rewriter",
"troubleshooting_filter_tags.report": "Relatório",
"troubleshooting_filter_tags.export": "Exportação",
"troubleshooting_filter_tags.dashboard": "Dashboard",
"troubleshooting_filter_tags.vtex_admin": "VTEX Admin",
"troubleshooting_filter_tags.overview": "Visão geral",
"troubleshooting_filter_tags.user_roles": "Perfis de acesso",
"troubleshooting_filter_tags.reservation": "Reserva",
"troubleshooting_filter_tags.xml_integration": "Integração XML",
"troubleshooting_filter_tags.stock": "Estoque",
"troubleshooting_filter_tags.order_status": "Status do pedido",
"troubleshooting_filter_tags.invoice": "Fatura",
"troubleshooting_filter_tags.site_editor": "Site Editor",
"troubleshooting_filter_tags.cms": "CMS",
"troubleshooting_filter_tags.store_framework": "Store Framework",
"troubleshooting_filter_tags.promotions": "Promoções",
"troubleshooting_filter_tags.affiliate": "Afiliado",
"troubleshooting_filter_tags.request_headers": "Request headers",
"troubleshooting_filter_tags.utm": "UTM",
"troubleshooting_filter_tags.custom_javascript": "Javascript customizado",
"troubleshooting_filter_tags.separate_deliveries": "Envios separados",
"troubleshooting_filter_tags.order_split": "Split de pedidos",
"troubleshooting_filter_tags.packages": "Pacotes",
"troubleshooting_filter_tags.shipping": "Entrega",
"troubleshooting_filter_tags.pre_sale": "Pré-venda",
"troubleshooting_page_search.placeholder": "Buscar por identificações, diagnósticos e correções de falhas..."
}
20 changes: 17 additions & 3 deletions src/pages/troubleshooting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import TroubleshootingCard from 'components/troubleshooting-card'
import Pagination from 'components/pagination'
import { TroubleshootingFilters } from 'utils/constants'
import Filter from 'components/filter'
import searchIcon from '../../components/icons/search-icon'
import Input from 'components/input'

interface Props {
sidebarfallback: any //eslint-disable-line
Expand All @@ -43,15 +45,19 @@ const TroubleshootingPage: NextPage<Props> = ({
const [pageIndex, setPageIndex] = useState({ curr: 1, total: 1 })
const [filters, setFilters] = useState<string[]>([])
const [sortByValue, setSortByValue] = useState<SortByType>('newest')
const [search, setSearch] = useState<string>('')

const filteredResult = useMemo(() => {
const data = troubleshootingData
.filter((troubleshoot) => troubleshoot.status === 'PUBLISHED')
.filter((troubleshoot) => {
return (
const hasFilters: boolean =
filters.length === 0 ||
troubleshoot.tags.some((tag) => filters.includes(tag))
)
const hasSearch: boolean = troubleshoot.title
.toLowerCase()
.includes(search.toLowerCase())
return hasSearch && hasFilters
})

data.sort((a, b) => {
Expand All @@ -66,7 +72,7 @@ const TroubleshootingPage: NextPage<Props> = ({
setPageIndex({ curr: 1, total: Math.ceil(data.length / itemsPerPage) })

return data
}, [filters, sortByValue, intl.locale])
}, [filters, sortByValue, intl.locale, search])

const paginatedResult = usePagination<TroubleshootingDataElement>(
itemsPerPage,
Expand Down Expand Up @@ -117,6 +123,14 @@ const TroubleshootingPage: NextPage<Props> = ({
onSelect={(ordering) => setSortByValue(ordering as SortByType)}
/>
</Flex>
<Input
placeholder={intl.formatMessage({
id: 'troubleshooting_page_search.placeholder',
})}
Icon={searchIcon}
value={search}
onChange={(value: string) => setSearch(value)}
/>
<Flex sx={styles.cardContainer}>
{paginatedResult.length === 0 && (
<Flex sx={styles.noResults}>
Expand Down
Loading
Loading