Skip to content

Commit f4b1f90

Browse files
committed
Adapt and fix one playground
1 parent 39b51e6 commit f4b1f90

File tree

17 files changed

+520
-377
lines changed

17 files changed

+520
-377
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
"turbo": "^2.3.3",
4747
"algoliasearch-helper": "^3.23.0",
4848
"@changesets/cli": "^2.26.1",
49-
"typescript": "^5.7.3"
49+
"typescript": "^5.7.3",
50+
"@algolia/client-search": "^5.19.0",
51+
"algoliasearch": "^5.19.0",
52+
"search-insights": "^2.17.3"
5053
},
5154
"packageManager": "[email protected]"
5255
}

packages/autocomplete-client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"@algolia/autocomplete-js": "^1.7.4",
5050
"cssnano": "^4.1.10",
5151
"eslint-config-meilisearch": "*",
52-
"instantsearch.js": "^4.56.2",
53-
"regenerator-runtime": "^0.13.7"
52+
"instantsearch.js": "^4.56.2"
5453
}
5554
}

packages/instant-meilisearch/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"concurrently": "^7.1.0",
5454
"cssnano": "^4.1.10",
5555
"eslint-config-meilisearch": "*",
56-
"instantsearch.js": "^4.56.2",
57-
"regenerator-runtime": "^0.13.7"
56+
"instantsearch.js": "^4.56.2"
5857
}
5958
}

playgrounds/local-react/.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"local": {
3-
"host": "http://localhost:9999"
3+
"host": "http://localhost:5173"
44
}
55
}

playgrounds/local-react/cypress/integration/search-ui.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ describe(`${playground} playground test`, () => {
1919
cy.contains('15 results')
2020
})
2121

22-
it('Contains filter clear', () => {
23-
cy.contains('Clear all filters')
22+
it('Contains refinements clear', () => {
23+
cy.contains('Clear refinements')
2424
})
2525

2626
it('Contains Genres', () => {

playgrounds/local-react/package.json

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"private": true,
55
"description": "React playground for instant-meilisearch",
66
"scripts": {
7-
"predev": "node setup.js",
8-
"dev": "parcel serve index.html --open --port 9999",
9-
"build": "parcel build index.html",
10-
"setup": "node setup.js",
7+
"predev": "node setup.mjs",
8+
"dev": "vite",
9+
"build": "vite build",
10+
"setup": "node setup.mjs",
1111
"lint": "eslint --ext .jsx,.js .",
1212
"lint:fix": "eslint --ext .jsx,.js --fix .",
13-
"test:e2e": "concurrently --kill-others -s first \"yarn dev\" \"cypress run --env playground=local\"",
13+
"test:e2e": "concurrently --kill-others -s first \"yarn dev\" \"cypress run --env playground=local --headed --no-exit\"",
1414
"test:e2e:watch": "concurrently --kill-others -s first \"yarn dev\" \"cypress open --env playground=local\""
1515
},
1616
"keywords": [
@@ -22,19 +22,14 @@
2222
],
2323
"author": "",
2424
"license": "ISC",
25-
"dependencies": {
26-
"@meilisearch/instant-meilisearch": "0.23.0",
27-
"instantsearch.css": "^8.0.0",
28-
"react": "^17.0.1",
29-
"react-dom": "^17.0.1",
30-
"react-instantsearch-dom": "^6.40.4",
31-
"react-router-dom": "^6.14.2"
32-
},
3325
"devDependencies": {
34-
"@babel/core": "^7.20.5",
35-
"@babel/plugin-syntax-jsx": "^7.22.5",
36-
"@babel/plugin-transform-runtime": "^7.22.5",
37-
"@babel/preset-react": "^7.22.5",
26+
"@meilisearch/instant-meilisearch": "*",
27+
"instantsearch.css": "^8.5.1",
28+
"react": "^18.3.1",
29+
"react-dom": "^18.3.1",
30+
"@vitejs/plugin-react": "^4.3.4",
31+
"react-instantsearch": "^7.15.0",
32+
"react-router-dom": "^7.1.3",
3833
"eslint-config-meilisearch": "*"
3934
}
40-
}
35+
}

playgrounds/local-react/setup.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

playgrounds/local-react/setup.mjs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { MeiliSearch } from "meilisearch";
2+
import movies from "./assets/movies.json" with { type: "json" };
3+
import games from "./assets/games.json" with { type: "json" };
4+
5+
const client = new MeiliSearch({
6+
host: "http://127.0.0.1:7700",
7+
apiKey: "masterKey",
8+
});
9+
10+
const moviesIndex = client.index("movies");
11+
const gamesIndex = client.index("games");
12+
13+
await moviesIndex.delete();
14+
await gamesIndex.delete();
15+
16+
await moviesIndex.updateSettings({
17+
filterableAttributes: ["genres", "color", "platforms"],
18+
});
19+
await gamesIndex.updateSettings({
20+
filterableAttributes: ["genres", "color", "platforms", "misc", "players"],
21+
searchableAttributes: ["name", "description"],
22+
sortableAttributes: ["recommendationCount"],
23+
});
24+
25+
const moviesRes = await moviesIndex.addDocuments(movies);
26+
const gamesRes = await gamesIndex.addDocuments(games);
27+
28+
const moviesTask = await client.waitForTask(moviesRes.taskUid);
29+
const gamesTask = await client.waitForTask(gamesRes.taskUid);
30+
console.log(moviesTask);
31+
console.log(gamesTask);
Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
import React from 'react'
2-
import { Routes, Route, Outlet } from 'react-router-dom'
3-
import SingleIndex from './components/SingleIndex'
4-
import MultiIndex from './components/MultiIndex'
5-
import SingleMovieIndex from './components/SingleMovieIndex'
1+
import { Routes, Route, Outlet } from "react-router-dom";
2+
import SingleIndex from "./components/SingleIndex";
3+
import MultiIndex from "./components/MultiIndex";
4+
import SingleMovieIndex from "./components/SingleMovieIndex";
5+
import "./App.css";
66

7-
import './App.css'
7+
const App = () => (
8+
<div>
9+
<Routes>
10+
<Route path="/" element={<SingleIndex />} />
11+
<Route path="multi-index" element={<MultiIndex />} />
12+
<Route path="movie-index" element={<SingleMovieIndex />} />
13+
</Routes>
14+
<Outlet />
15+
</div>
16+
);
817

9-
const App = () => {
10-
return (
11-
<div>
12-
<Routes>
13-
<Route path="/" element={<SingleIndex />} />
14-
<Route path="multi-index" element={<MultiIndex />} />
15-
<Route path="movie-index" element={<SingleMovieIndex />} />
16-
</Routes>
17-
<Outlet />
18-
</div>
19-
)
20-
}
21-
22-
export default App
18+
export default App;

0 commit comments

Comments
 (0)