Skip to content

Commit

Permalink
feat: add camera widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangtaofeng committed Feb 22, 2024
1 parent 9417f02 commit 006de35
Show file tree
Hide file tree
Showing 44 changed files with 2,035 additions and 12 deletions.
1 change: 1 addition & 0 deletions apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"react-use": "^17.4.0",
"react-use-measure": "^2.1.1",
"react-virtuoso": "^4.3.11",
"react-webcam": "^7.2.0",
"react-window": "^1.8.9",
"react-window-infinite-loader": "^1.0.9",
"rehype-raw": "^6.1.1",
Expand Down
4 changes: 4 additions & 0 deletions apps/builder/src/assets/camera/capture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions apps/builder/src/assets/camera/videoCaptruIng.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions apps/builder/src/assets/camera/videoCapture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions apps/builder/src/assets/widgetCover/camera.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const sessionTypeMapSessionNameKey = {
COMMON: i18n.t("editor.widget_picker.sessions.commonly"),
INPUTS: i18n.t("editor.widget_picker.sessions.inputs"),
SELECT: i18n.t("editor.widget_picker.sessions.selects"),
ILLA_DRIVE: i18n.t("editor.widget_picker.sessions.drive"),
FILE_INPUT: i18n.t("editor.widget_picker.sessions.files"),
CALENDAR: i18n.t("editor.widget_picker.sessions.calendar"),
PRESENTATION: i18n.t("editor.widget_picker.sessions.presentation"),
DATA: i18n.t("editor.widget_picker.sessions.data"),
Expand Down Expand Up @@ -50,7 +50,7 @@ const translateChildren = (componentConfigs: WidgetConfig[]) => {
const sessionConfigs: TypeMapComponent = {
COMMON: [],
INPUTS: [],
ILLA_DRIVE: [],
FILE_INPUT: [],
SELECT: [],
CALENDAR: [],
DATA: [],
Expand Down
5 changes: 4 additions & 1 deletion apps/builder/src/page/App/components/DotPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ export const DotPanel: FC = () => {
<MouseHoverProvider>
<MouseMoveProvider>
{isMobileAPP ? (
<div css={applyMobileViewportContainerWrapperStyle(mode)}>
<div
data-mobile-fullscreen-container={true}
css={applyMobileViewportContainerWrapperStyle(mode)}
>
<RenderPage
key={currentDisplayName}
currentPageDisplayName={currentDisplayName}
Expand Down
10 changes: 10 additions & 0 deletions apps/builder/src/services/drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,13 @@ export const fetchGCSUploadPresignedURL = async (
return Promise.reject(e)
}
}

export const fetchDeleteFile = async (id: string) => {
return await driveRequest<null>(
{
url: `/files/${id}`,
method: "DELETE",
},
{ teamID: getCurrentTeamID() },
)
}
3 changes: 2 additions & 1 deletion apps/builder/src/utils/eventHandlerHelper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ export const transformEvents = (
widgetMethod === "resetValue" ||
widgetMethod === "resetMarkers" ||
widgetMethod === "onFreeTimeDragOrClick" ||
widgetMethod === "openScanner"
widgetMethod === "openScanner" ||
widgetMethod === "openCamera"
) {
return {
script: `{{${widgetID}.${widgetMethod}()}}`,
Expand Down
2 changes: 2 additions & 0 deletions apps/builder/src/utils/mediaSourceLoad/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ export const getReportElementByWidget = (
return `${prefix}traffic_not_enough_video`
case "AUDIO_WIDGET":
return `${prefix}traffic_not_enough_audio`
case "CAMERA_WIDGET":
return `${prefix}traffic_not_enough_camera`
}
}
6 changes: 6 additions & 0 deletions apps/builder/src/utils/userAgent/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const MOBILE_USER_AGENT = /Android|webOS|iPhone|iPod|BlackBerry/i

export const getUserPlatform = () => {
const platform =
"userAgentData" in navigator
Expand Down Expand Up @@ -28,3 +30,7 @@ export const isWindows = () => {
export const isLinux = () => {
return getUserPlatform() === "Linux"
}

export const isMobileByUserAgent = () => {
return MOBILE_USER_AGENT.test(navigator?.userAgent)
}
Loading

0 comments on commit 006de35

Please sign in to comment.