Added shortcut to clear search input. Updated README, CHANGELOG and Home screenshot. Added docker-compose

This commit is contained in:
Paweł Malak
2021-10-14 16:05:25 +02:00
parent fa7f54d0e1
commit a5e027102b
6 changed files with 39 additions and 5 deletions

BIN
.github/img/home.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

@@ -1,4 +1,4 @@
### v1.4 (TBA) ### v1.4 (2021-10-14)
- Added search functionality ([#18](https://github.com/pawelmalak/snippet-box/issues/18)) - Added search functionality ([#18](https://github.com/pawelmalak/snippet-box/issues/18))
- Fixed date parsing bug ([#22](https://github.com/pawelmalak/snippet-box/issues/22)) - Fixed date parsing bug ([#22](https://github.com/pawelmalak/snippet-box/issues/22))
- Minor UI fixes - Minor UI fixes

View File

@@ -64,12 +64,29 @@ docker buildx build \
docker run -p 5000:5000 -v /path/to/data:/app/data snippet-box docker run -p 5000:5000 -v /path/to/data:/app/data snippet-box
``` ```
#### Docker Compose
```yaml
version: '3'
services:
snippet-box:
image: pawelmalak/snippet-box:latest
container_name: snippet-box
volumes:
- /path/to/host/data:/app/data
ports:
- 5000:5000
restart: unless-stopped
```
### Without Docker ### Without Docker
Follow instructions from wiki - [Installation without Docker](https://github.com/pawelmalak/snippet-box/wiki/Installation-without-Docker) Follow instructions from wiki - [Installation without Docker](https://github.com/pawelmalak/snippet-box/wiki/Installation-without-Docker)
## Functionality ## Functionality
- Search
- Search your snippets with built-in tags and language filters
- Pinned snippets - Pinned snippets
- Pin your favorite / important snippets to home screen for easy and quick access - Pin your favorite / important snippets to home screen for easy and quick access
@@ -92,3 +109,9 @@ Follow instructions from wiki - [Installation without Docker](https://github.com
- Create and edit your snippets from simple and easy to use editor - Create and edit your snippets from simple and easy to use editor
![Editor screenshot](./.github/img/editor.png) ![Editor screenshot](./.github/img/editor.png)
## Usage
### Search functionality
Visit wiki for search functionality and available filters reference: [Search functionality](https://github.com/pawelmalak/snippet-box/wiki/Search-functionality)

View File

@@ -15,6 +15,9 @@ export const SearchBar = (): JSX.Element => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
searchSnippets(query); searchSnippets(query);
} else if (e.key === 'Escape') {
inputRef.current.value = '';
searchSnippets(searchParser(inputRef.current.value));
} }
}; };
@@ -27,8 +30,8 @@ export const SearchBar = (): JSX.Element => {
ref={inputRef} ref={inputRef}
onKeyUp={e => inputHandler(e)} onKeyUp={e => inputHandler(e)}
/> />
<div className='form-text text-gray'> <div className='form-text text-gray ms-1'>
Submit search query by pressing `Enter`. Read more about available Search by pressing `Enter`. Clear with `Esc`. Read more about available
filters{' '} filters{' '}
<a <a
href='https://github.com/pawelmalak/snippet-box/wiki/Search-filters' href='https://github.com/pawelmalak/snippet-box/wiki/Search-filters'

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
version: '3'
services:
snippet-box:
image: pawelmalak/snippet-box
container_name: snippet-box
volumes:
- /path/to/host/data:/app/data
ports:
- 5000:5000
restart: unless-stopped

View File

@@ -121,8 +121,6 @@ export const getSnippet = asyncWrapper(
*/ */
export const updateSnippet = asyncWrapper( export const updateSnippet = asyncWrapper(
async (req: Request, res: Response, next: NextFunction): Promise<void> => { async (req: Request, res: Response, next: NextFunction): Promise<void> => {
console.log(req.body);
let snippet = await SnippetModel.findOne({ let snippet = await SnippetModel.findOne({
where: { id: req.params.id } where: { id: req.params.id }
}); });