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

fix: vue-examples - reactive-list #2273

Merged
merged 4 commits into from
Dec 9, 2023
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
13 changes: 13 additions & 0 deletions packages/vue/examples/ai-answer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AI Answer Demo</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
44 changes: 14 additions & 30 deletions packages/vue/examples/ai-answer/package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
{
"name": "ai-answer",
"version": "0.1.0",
"name": "example-vue3",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"serve": "volar-preview-vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@appbaseio/reactivesearch-vue": "3.3.0",
"vue": "^3.2.5"
"@appbaseio/reactivesearch-vue": "3.3.0",
"vue": "^3.3.9",
"vuejs-paginate": "^2.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/compiler-sfc": "^3.1.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
"@codesandbox/vue-preview": "^0.1.1-alpha.16",
"@vitejs/plugin-vue": "^4.5.0",
"@vue/babel-preset-app": "^5.0.8",
"vite": "^5.0.4"
}
}
172 changes: 90 additions & 82 deletions packages/vue/examples/ai-answer/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<template>
<div id="app">
<reactive-base
app="good-books-ds"
url="https://a03a1cb71321:75b6603d-9456-4a5a-af6b-a487b309eb61@appbase-demo-ansible-abxiydt-arc.searchbase.io"
themePreset="light"
>
<search-box
className="result-list-container"
componentId="BookSensor"
:dataField="['original_title', 'original_title.search']"
:URLParams="true"
:size="10"
:enablePopularSuggestions="true"
:popularSuggestionsConfig="{ size: 3, minChars: 2, index: 'good-books-ds' }"
:enableRecentSuggestions="true"
:recentSuggestionsConfig="{
size: 3,
index: 'good-books-ds',
minChars: 4,
}"
:enableAI="false"
:autosuggest="true"
/>
<a-i-answer
className="ai-answer"
componentId="AIComponent"
:react="{ and: ['BookSensor'] }"
title="AI Chat Box"
:showSourceDocuments="true"
:onSourceClick="
(sourceObj) => {
// perform any side effects
console.log('sourceObj', sourceObj);
}
"
>
<!-- <template v-slot:render="{ loading, data, error }">
<div id="app">
<reactive-base
app="good-books-ds"
url="https://a03a1cb71321:75b6603d-9456-4a5a-af6b-a487b309eb61@appbase-demo-ansible-abxiydt-arc.searchbase.io"
theme-preset="light"
>
<search-box
:data-field="['original_title', 'original_title.search']"
:urlparams="true"
:size="10"
:enable-popular-suggestions="true"
:popular-suggestions-config="{ size: 3, minChars: 2, index: 'good-books-ds' }"
:enable-recent-suggestions="true"
:recent-suggestions-config="{
size: 3,
index: 'good-books-ds',
minChars: 4,
}"
:enable-ai="false"
:autosuggest="true"
class-name="result-list-container"
component-id="BookSensor"
/>
<a-i-answer
:react="{ and: ['BookSensor'] }"
:show-source-documents="true"
:on-source-click="
(sourceObj) => {
// perform any side effects
console.log('sourceObj', sourceObj);
}
"
class-name="ai-answer"
component-id="AIComponent"
title="AI Chat Box"
>
<!-- <template v-slot:render="{ loading, data, error }">
<div v-if="loading">loading...</div>
<pre v-else-if="error">{{ JSON.stringify(error) }}</pre>
<div
Expand All @@ -60,58 +60,66 @@
<div>{{ JSON.stringify(errorParam) }}</div>
<button v-on:click="handleRetry">fff</button>
</template> -->
</a-i-answer>
<reactive-list
componentId="SearchResult"
dataField="original_title.keyword"
className="result-list-container"
:pagination="true"
:size="5"
:react="{ and: ['BookSensor'] }"
>
<template #renderItem="{ item }">
<div :id="item._id" class="flex book-content" :key="item._id">
<img :src="item.image" alt="Book Cover" class="book-image" />
<div class="flex column justify-center ml20">
<div class="book-header">{{ item.original_title }}</div>
<div class="flex column justify-space-between">
<div>
<div>
by <span class="authors-list">{{ item.authors }}</span>
</div>
<div class="ratings-list flex align-center">
<span class="stars">
<i
v-for="(item, index) in Array(
item.average_rating_rounded,
).fill('x')"
class="fas fa-star"
:key="index"
/>
</span>
<span class="avg-rating"
>({{ item.average_rating }} avg)</span
>
</div>
</div>
<span class="pub-year"
>Pub {{ item.original_publication_year }}</span
>
</div>
</div>
</div>
</template>
</reactive-list>
</reactive-base>
</div>
</a-i-answer>
<reactive-list
:pagination="true"
:size="5"
:react="{ and: ['BookSensor'] }"
component-id="SearchResult"
data-field="original_title.keyword"
class-name="result-list-container"
>
<template #renderItem="{ item }">
<div
:id="item._id"
:key="item._id"
class="flex book-content">
<img
:src="item.image"
alt="Book Cover"
class="book-image" >
<div class="flex column justify-center ml20">
<div class="book-header">{{ item.original_title }}</div>
<div class="flex column justify-space-between">
<div>
<div>
by <span class="authors-list">{{ item.authors }}</span>
</div>
<div class="ratings-list flex align-center">
<span class="stars">
<i
v-for="(item, index) in Array(
item.average_rating_rounded,
).fill('x')"
:key="index"
class="fas fa-star"
/>
</span>
<span
class="avg-rating"
>({{ item.average_rating }} avg)</span
>
</div>
</div>
<span
class="pub-year"
>Pub {{ item.original_publication_year }}</span
>
</div>
</div>
</div>
</template>
</reactive-list>
</reactive-base>
</div>
</template>

<script>
import './styles.css';
import { ReactiveBase, ReactiveList, SearchBox, AIAnswer } from '@appbaseio/reactivesearch-vue';

export default {
name: 'app',
name: 'App',
components: { ReactiveBase, ReactiveList, SearchBox, AIAnswer },
methods: {
getMessageStyle(message) {
Expand Down
23 changes: 23 additions & 0 deletions packages/vue/examples/ai-answer/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable import/no-extraneous-dependencies */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
optimizeDeps: {
include: [
'@appbaseio/reactivecore',
'@appbaseio/reactivesearch-vue',
'fast-deep-equal',
],
},
plugins: [vue()],
build: {
rollupOptions: {
input: 'src/main.js'
},
commonjsOptions: {
include: [/reactivecore/, /reactivesearch/, /node_modules/],
},
}
})
13 changes: 13 additions & 0 deletions packages/vue/examples/analytics-with-hook/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Analytics with Hook Demo</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
44 changes: 14 additions & 30 deletions packages/vue/examples/analytics-with-hook/package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
{
"name": "analytics-with-hook-vue",
"version": "0.1.0",
"name": "example-vue3",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"serve": "volar-preview-vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@appbaseio/reactivesearch-vue": "3.3.0",
"vue": "^3.2.5"
"@appbaseio/reactivesearch-vue": "3.3.0",
"vue": "^3.3.9",
"vuejs-paginate": "^2.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/compiler-sfc": "^3.1.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
"@codesandbox/vue-preview": "^0.1.1-alpha.16",
"@vitejs/plugin-vue": "^4.5.0",
"@vue/babel-preset-app": "^5.0.8",
"vite": "^5.0.4"
}
}
Loading
Loading