Skip to content

Commit a4dc2da

Browse files
committed
refactor: removed devilbox and added lando
1 parent f6bd3aa commit a4dc2da

File tree

8,687 files changed

+8412
-1662489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

8,687 files changed

+8412
-1662489
lines changed

app/.env .env.example

File renamed without changes.

app/.gitignore .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
1+
.DS_Store
2+
.idea
23
###> symfony/framework-bundle ###
34
/.env.local
45
/.env.local.php
@@ -15,3 +16,4 @@
1516
npm-debug.log
1617
yarn-error.log
1718
###< symfony/webpack-encore-bundle ###
19+
.env

.lando.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# https://docs.lando.dev/plugins/symfony/config.html
2+
3+
name: hyper-search
4+
recipe: symfony
5+
config:
6+
webroot: ./public
7+
php: '8.2'
8+
via: nginx
9+
cache: memcached
10+
services:
11+
appserver:
12+
run:
13+
- composer install
14+
- bin/console manticore:migrate
15+
- bin/console manticore:seed
16+
overrides:
17+
ports:
18+
- 1241
19+
scanner:
20+
okCodes:
21+
- 426
22+
node:
23+
type: node:18
24+
run:
25+
- yarn
26+
- yarn build
27+
manticore:
28+
api: 3
29+
type: lando
30+
services:
31+
image: manticoresearch/manticore:6.2.12
32+
command: /usr/local/bin/docker-entrypoint.sh su - manticore -c '/usr/bin/searchd -c /etc/manticoresearch/manticore.conf --nodetach'
33+
ports:
34+
- 9306:9306
35+
- 9308:9308
36+
volumes:
37+
- manticore_volume:/var/lib/manticore
38+
ulimits:
39+
nproc: 65535
40+
nofile:
41+
soft: 65535
42+
hard: 65535
43+
memlock:
44+
soft: -1
45+
hard: -1
46+
volumes:
47+
manticore_volume: {}
48+
tooling:
49+
node:
50+
service: node
51+
npm:
52+
service: node
53+
yarn:
54+
service: node
55+
pnpm:
56+
service: node
57+
proxy:
58+
appserver:
59+
- ws.lndo.site:1241

app/.idea/.gitignore

-8
This file was deleted.

app/.idea/app.iml

-57
This file was deleted.

app/.idea/modules.xml

-8
This file was deleted.

app/.idea/php.xml

-68
This file was deleted.

app/.idea/vcs.xml

-7
This file was deleted.

app/src/Controller/MainController.php

-16
This file was deleted.

app/templates/index.html.twig

-7
This file was deleted.

app/assets/app.ts assets/app.ts

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

app/assets/react/components/Result.tsx assets/react/components/Result.tsx

+43-6
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,35 @@ import React from "react";
1111
import {SearchIcon} from "@chakra-ui/icons";
1212
import NotFound from "./NotFound";
1313
import Bar from "./Bar";
14+
import ResultItem from "./ResultItem";
15+
16+
export interface SearchResultProps {
17+
_id: string;
18+
_score: number;
19+
_source: {
20+
description: string;
21+
title: string;
22+
location: string;
23+
link: string;
24+
}
25+
}
1426

1527
export interface ResultProps {
1628
isWarpStarted: boolean;
29+
data: SearchResultProps[];
1730
}
1831

1932
const Result: React.FC<ResultProps> = (
2033
{
2134
isWarpStarted,
35+
data,
2236
}) => {
2337
const buttonData: {
2438
id: number;
2539
label: string;
2640
icon?: React.ReactElement;
2741
backgroundColor?: string;
28-
}[] = [
42+
}[] = [ // TODO: Make dynamic
2943
{id: 1, label: 'Documentations', icon: <Icon as={IoDocumentTextSharp}/>, backgroundColor: '#FF6384'},
3044
{id: 2, label: 'Knowledgebases', icon: <Icon as={IoBulbSharp}/>, backgroundColor: '#36A2EB'},
3145
{id: 3, label: 'Forums', icon: <Icon as={IoChatbubblesSharp}/>, backgroundColor: '#FFCE56'},
@@ -38,7 +52,7 @@ const Result: React.FC<ResultProps> = (
3852
const borderColor = useColorModeValue('secondaryGray.200', 'gray.800');
3953
const bgColor = useColorModeValue('gray.100', 'navy.700');
4054
const bgColorHover = useColorModeValue('gray.200', 'navy.800');
41-
55+
const [currentLocation, setCurrentLocation] = React.useState<string | null>(null);
4256

4357
return (
4458
<Collapse in={isWarpStarted}>
@@ -54,11 +68,15 @@ const Result: React.FC<ResultProps> = (
5468
flexDirection='column'
5569
borderRight={'1px'}
5670
borderColor={borderColor}>
57-
{buttonData.map((button) => (
71+
{buttonData.map((button, index) => (
5872
<Button
5973
_hover={{bg: bgColorHover}}
6074
_focusVisible={{bg: bgColorHover}}
6175
boxShadow={'none'}
76+
bg={currentLocation === button.label ? bgColorHover : bgColor}
77+
onFocus={() => setCurrentLocation(button.label)}
78+
onMouseOver={() => setCurrentLocation(button.label)}
79+
onClick={() => setCurrentLocation(button.label)}
6280
leftIcon={
6381
<>
6482
<Box
@@ -81,7 +99,7 @@ const Result: React.FC<ResultProps> = (
8199
borderRadius={0}
82100
paddingX={'1rem'}
83101
paddingY={'2rem'}
84-
key={button.id}
102+
key={index}
85103
variant='ghost'
86104
>
87105
<div>
@@ -93,14 +111,33 @@ const Result: React.FC<ResultProps> = (
93111
fontSize: '0.65rem',
94112
textAlign: 'left',
95113
}
96-
}>0 results</Text>
114+
}>{data.filter(result => result._source.location === button.label).length} results</Text>
97115
</div>
98116

99117
</Button>
100118
))}
101119
</GridItem>
102120

103-
<NotFound/>
121+
{
122+
data.length === 0 ?
123+
<NotFound/>
124+
:
125+
<Grid gap={0} maxHeight={'500px'} overflowY={'auto'}>
126+
{data.map((result, index) => (
127+
<React.Fragment key={index}>
128+
{
129+
currentLocation === null ?
130+
<ResultItem {...result._source}/>
131+
:
132+
result._source.location === currentLocation ?
133+
<ResultItem {...result._source}/>
134+
:
135+
null
136+
}
137+
</React.Fragment>
138+
))}
139+
</Grid>
140+
}
104141

105142
<GridItem
106143
w='100%'

0 commit comments

Comments
 (0)