Skip to content

Commit

Permalink
Release v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-khomutovskyi-qb committed Dec 22, 2023
1 parent 3a971f5 commit 371552b
Show file tree
Hide file tree
Showing 62 changed files with 771 additions and 305 deletions.
3 changes: 3 additions & 0 deletions .env → .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ OPENAI_API_KEY=""
AI_QUICK_ANSWER=false
AI_SUGGEST_PROVIDER=false
AI_RECORD_ANALYTICS=false
AI_REPHRASE=false
AI_TRANSLATE=false
PROVIDER_ASSISTANT_ID=-1
APP_NAME="Q-Consultation"
APP_DESCRIPTION="Q-Consultation"
ENABLE_REDUX_LOGGER=false
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ jobs:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Build website
run: cd ./packages/documentation && npm run build
uses: borales/actions-yarn@v4
with:
cmd: build
dir: documentation

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
Expand All @@ -30,7 +36,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./packages/documentation/build
publish_dir: ./documentation/build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ yarn-error.log
.idea
.tmp

.env

cache
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qc-apps/api",
"version": "2.2.0",
"version": "2.3.0",
"private": true,
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qc-apps/client",
"version": "2.2.0",
"version": "2.3.0",
"private": true,
"license": "MIT",
"author": {
Expand Down
21 changes: 21 additions & 0 deletions apps/client/src/actionCreators/qb-appointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,24 @@ export function clearAppointmentsOfDeletedUsers(
): Types.QBClearAppointmentsOfDeletedUsers {
return { type: Types.QB_CLEAR_APPOINTMENT_OF_DELETED_USERS, payload }
}

export function createAppointmentDialog(
payload: Types.QBAppointmentDialogCreateRequestAction['payload'],
): Types.QBAppointmentDialogCreateRequestAction {
return { type: Types.QB_APPOINTMENT_DIALOG_CREATE_REQUEST, payload }
}

export function createAppointmentDialogSuccess(
appointment: QBAppointment,
): Types.QBAppointmentDialogCreateSuccessAction {
return {
type: Types.QB_APPOINTMENT_DIALOG_CREATE_SUCCESS,
payload: appointment,
}
}

export function createAppointmentDialogFailure(
error: string,
): Types.QBAppointmentDialogCreateFailureAction {
return { type: Types.QB_APPOINTMENT_DIALOG_CREATE_FAILURE, error }
}
10 changes: 4 additions & 6 deletions apps/client/src/actionCreators/qb-dialogs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QBAppointment, QBChatDialog, QBUser } from '@qc/quickblox'
import { QBChatDialog } from '@qc/quickblox'
import * as Types from '../actions'

export function getDialog<T extends Types.GetDialogPayload>(
Expand All @@ -19,11 +19,9 @@ export function getDialogFailure(
return { type: Types.QB_DIALOG_GET_FAILURE, error }
}

export function createDialog(payload: {
userId: QBUser['id']
data?: { class_name: string; _id: QBAppointment['_id'] }
then?: (data: Types.QBDialogCreateSuccessAction) => void
}): Types.QBDialogCreateRequestAction {
export function createDialog(
payload: Types.QBDialogCreateRequestAction['payload'],
): Types.QBDialogCreateRequestAction {
return { type: Types.QB_DIALOG_CREATE_REQUEST, payload }
}

Expand Down
31 changes: 29 additions & 2 deletions apps/client/src/actions/qb-appointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export const QB_APPOINTMENT_CREATE_FAILURE = 'QB_APPOINTMENT_CREATE_FAILURE'
export const QB_APPOINTMENT_UPDATE_REQUEST = 'QB_APPOINTMENT_UPDATE_REQUEST'
export const QB_APPOINTMENT_UPDATE_SUCCESS = 'QB_APPOINTMENT_UPDATE_SUCCESS'
export const QB_APPOINTMENT_UPDATE_FAILURE = 'QB_APPOINTMENT_UPDATE_FAILURE'
export const QB_APPOINTMENT_DIALOG_CREATE_REQUEST =
'QB_APPOINTMENT_DIALOG_CREATE_REQUEST'
export const QB_APPOINTMENT_DIALOG_CREATE_SUCCESS =
'QB_APPOINTMENT_DIALOG_CREATE_SUCCESS'
export const QB_APPOINTMENT_DIALOG_CREATE_FAILURE =
'QB_APPOINTMENT_DIALOG_CREATE_FAILURE'
export const QB_CLEAR_APPOINTMENT_OF_DELETED_USERS =
'QB_CLEAR_APPOINTMENT_OF_DELETED_USERS'

Expand Down Expand Up @@ -44,11 +50,9 @@ export interface QBAppointmentCreateSuccessAction extends Action {
export interface QBAppointmentCreateRequestAction extends Action {
type: typeof QB_APPOINTMENT_CREATE_REQUEST
payload: {
dialog_id: QBChatDialog['_id']
client_id: QBUser['id']
provider_id: QBUser['id']
description: string
date_end?: string
then?: (data: QBAppointmentCreateSuccessAction) => void
}
}
Expand Down Expand Up @@ -82,6 +86,26 @@ export interface QBClearAppointmentsOfDeletedUsers extends Action {
payload: Array<QBAppointment['_id']>
}

export interface QBAppointmentDialogCreateSuccessAction extends Action {
type: typeof QB_APPOINTMENT_DIALOG_CREATE_SUCCESS
payload: QBAppointment
}

export interface QBAppointmentDialogCreateRequestAction extends Action {
type: typeof QB_APPOINTMENT_DIALOG_CREATE_REQUEST
payload: {
dialog_id: QBChatDialog['_id']
client_id: QBUser['id']
provider_id: QBUser['id']
then?: (data: QBAppointmentDialogCreateSuccessAction) => void
}
}

export interface QBAppointmentDialogCreateFailureAction extends Action {
type: typeof QB_APPOINTMENT_DIALOG_CREATE_FAILURE
error: string
}

export type QBAppointmentAction =
| QBAppointmentGetRequestAction
| QBAppointmentGetSuccessAction
Expand All @@ -93,3 +117,6 @@ export type QBAppointmentAction =
| QBAppointmentUpdateSuccessAction
| QBAppointmentUpdateFailureAction
| QBClearAppointmentsOfDeletedUsers
| QBAppointmentDialogCreateRequestAction
| QBAppointmentDialogCreateSuccessAction
| QBAppointmentDialogCreateFailureAction
3 changes: 2 additions & 1 deletion apps/client/src/actions/qb-dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export interface QBDialogCreateSuccessAction extends Action {
export interface QBDialogCreateRequestAction extends Action {
type: typeof QB_DIALOG_CREATE_REQUEST
payload: {
userId: QBUser['id']
userIds: QBUser['id'] | Array<QBUser['id']>
type: 'group' | 'private'
data?: { class_name: string; _id: QBAppointment['_id'] }
then?: (data: QBDialogCreateSuccessAction) => void
}
Expand Down
76 changes: 39 additions & 37 deletions apps/client/src/modules/Appointment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function Appointment(props: AppointmentProps) {
const { onOpen } = props
const {
store: { appointment, myAccount },
data: { description, editingDescription, isOffline },
data: { description, editingDescription, isOffline, isNotAssistant },
handlers: {
changeDescription,
startEditingDescription,
Expand Down Expand Up @@ -44,42 +44,44 @@ export default function Appointment(props: AppointmentProps) {
>
{t('OpenChat')}
</Button>
<form>
<fieldset>
<div className="legend">
<span className="label">{t('ConsultationTopic')}</span>
{editingDescription && (
<>
<button
className="save"
onClick={updateDescription}
type="button"
disabled={isOffline}
>
<CheckSvg className="icon check" />
</button>
<button
className="cancel"
onClick={stopEditingDescription}
type="button"
>
<SkipSvg className="icon" />
</button>
</>
)}
</div>
<textarea
id="description"
name="description"
placeholder={t('EnterQuestion')}
onChange={changeDescription}
onFocus={startEditingDescription}
disabled={!appointment}
rows={8}
value={description}
/>
</fieldset>
</form>
{isNotAssistant && (
<form>
<fieldset>
<div className="legend">
<span className="label">{t('ConsultationTopic')}</span>
{editingDescription && (
<>
<button
className="save"
onClick={updateDescription}
type="button"
disabled={isOffline}
>
<CheckSvg className="icon check" />
</button>
<button
className="cancel"
onClick={stopEditingDescription}
type="button"
>
<SkipSvg className="icon" />
</button>
</>
)}
</div>
<textarea
id="description"
name="description"
placeholder={t('EnterQuestion')}
onChange={changeDescription}
onFocus={startEditingDescription}
disabled={!appointment}
rows={8}
value={description}
/>
</fieldset>
</form>
)}
<div className="btn-group">
<button
type="button"
Expand Down
8 changes: 6 additions & 2 deletions apps/client/src/modules/Appointment/useComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChangeEvent, useEffect, useState } from 'react'
import { useSelector } from 'react-redux'
import { generatePath, useNavigate } from 'react-router-dom'
import QB from '@qc/quickblox'
import QB, { userHasTag } from '@qc/quickblox'

import { QBAppointment } from '@qc/quickblox/dist/types'
import { createUseComponent, useActions } from '../../hooks'
Expand All @@ -13,6 +13,7 @@ import {
import {
authMyAccountSelector,
createAppointmentByIdSelector,
createUsersProviderByAppointmentIdSelector,
} from '../../selectors'
import { createMapStateSelector } from '../../utils/selectors'
import { APPOINTMENT_NOTIFICATION } from '../../constants/notificationTypes'
Expand All @@ -27,21 +28,23 @@ export interface AppointmentProps {
const createSelector = (appointmentId?: QBAppointment['_id']) =>
createMapStateSelector({
appointment: createAppointmentByIdSelector(appointmentId),
provider: createUsersProviderByAppointmentIdSelector(appointmentId),
myAccount: authMyAccountSelector,
})

export default createUseComponent((props: AppointmentProps) => {
const { appointmentId } = props
const selector = createSelector(appointmentId)
const store = useSelector(selector)
const { appointment } = store
const { appointment, provider } = store
const actions = useActions({
updateAppointment,
sendSystemMessage,
toggleShowModal,
})
const navigate = useNavigate()
const isOffline = useIsOffLine()
const isNotAssistant = provider && !userHasTag(provider, 'bot')

const [description, setDescription] = useState('')
const [editingDescription, setEditingDescription] = useState(false)
Expand Down Expand Up @@ -115,6 +118,7 @@ export default createUseComponent((props: AppointmentProps) => {
description,
editingDescription,
isOffline,
isNotAssistant,
},
handlers: {
changeDescription,
Expand Down
23 changes: 19 additions & 4 deletions apps/client/src/modules/Chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ import useComponent, { ChatProps } from './useComponent'
import './styles.css'

export default function Chat(props: ChatProps) {
const { className, opened, onClose } = props
const {
className,
opened,
onClose,
enableAttachments,
enableRephrase,
enableTranslate,
} = props
const {
data: { dialogName },
store: { callDuration, currentDialog },
Expand All @@ -32,9 +39,17 @@ export default function Chat(props: ChatProps) {
</div>
</header>
<main>
<ChatMessages dialogId={currentDialog?._id} chatOpen={opened} />
<UploadIndicator />
<ChatInput dialogId={currentDialog?._id} />
<ChatMessages
dialogId={currentDialog?._id}
chatOpen={opened}
enableTranslate={enableTranslate}
/>
{enableAttachments && <UploadIndicator />}
<ChatInput
dialogId={currentDialog?._id}
enableAttachments={enableAttachments}
enableRephrase={enableRephrase}
/>
</main>
</aside>
)
Expand Down
Loading

0 comments on commit 371552b

Please sign in to comment.