-
Notifications
You must be signed in to change notification settings - Fork 44
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
Added support for frames and video playback using uiweb alpha #1509
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
In the
After fixing these issues, the files should look like this: // dev-mode-link-local-sdk.mjs
import chalk from 'chalk';
import { spawn } from 'child_process';
import { parse } from 'envfile';
import fs from 'fs';
import path from 'path';
import readline from 'readline';
// import package json
import packageJSON from './package.json' assert { type: 'json' };
const packageJSONWatcher = {
STORAGE_KEY: 'STORAGE_FOR_RESTORING_PACKAGE_JSON',
WATCH: ['@pushprotocol/uiweb'],
LOCAL_PACKAGES_REQ: [
'animejs@^2.2.0',
'classnames@^2.2.5',
'raf@^3.4.0',
'protobufjs@^7.2.6',
'@livepeer/react@^2.9.2',
'@livekit/components-react@^1.5.3',
'livekit-client@^1.15.13',
];
};
const envPresets = {
localsdk: {
ENFORCE_WEBPACK_LOCAL: 'TRUE',
},
prodsdk: {
ENFORCE_WEBPACK_LOCAL: 'FALSE',
}
};
const prepForDeployment = async (sdkENV, tag, start) => {
const cleanup = tag === 'cleanup' ? true : false;
const runapp = start === 'start' ? true : false;
if (sdkENV === 'localsdk') {
// prep for local sdk
console.log(chalk.bgBlack.white('Starting Local SDK Deployment Prebuild...'));
// record package json
const restorePackageValue = createRestorOGPackageValue();
// setup modified env
const envmodified = await verifyLocalSDKENV(sdkENV, restorePackageValue);
// call cleanup only if env is modified and tag is cleanup
if ((envmodified && tag === 'cleanup') || tag === 'forcecleanup') {
// env is modified, which means sdk path is changed, clean up node_modules, yarn cache and reinstall
await cleanupAndBuild(sdkENV);
}
} else if (sdkENV === 'prodsdk') {
// prep for prod sdk
console.log(chalk.bgBlack.white('Rolling back changes for Production SDK Deployment...'));
const envmodified = await verifyLocalSDKENV(sdkENV, null);
}
};
// package.json
...
"deploy:prod": "node build.mjs prod && yarn build && echo 'app.push.org' > ./build/CNAME && gh-pages -d build -r https://github.com/push-protocol/push-dapp-prod-deployment"
...
// vite.config.ts
import react from '@vitejs/plugin-react';
import { parse } from 'envfile';
import fs from 'fs';
import path from 'path';
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import vitePluginRequire from 'vite-plugin-require';
import svgr from 'vite-plugin-svgr';
import topLevelAwait from 'vite-plugin-top-level-await';
import viteTsconfigPaths from 'vite-tsconfig-paths';
// for local sdk linking
let addedAlias = {};
// to read and modify webpack config based on local sdk linking or production
let localSDKLinking = false;
const envpath = `./.localsdk.env`;
if (fs.existsSync(envpath)) {
const envData = fs.readFileSync(envpath, 'utf8');
const envObject = parse(envData);
if (envObject['ENFORCE_WEBPACK_LOCAL'] === 'TRUE') {
localSDKLinking = true;
}
}
if (localSDKLinking) {
addedAlias = {
// Use absolute paths for aliases
react: path.resolve(__dirname, './node_modules/react'),
'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
'react/jsx-runtime': path.resolve(__dirname, './node_modules/react/jsx-runtime'),
'react-icons': path.resolve(__dirname, './node_modules/react-icons'),
'react-easy-crop': path.resolve(__dirname, './node_modules/react-easy-crop'),
'react-image-file-resizer': path.resolve(__dirname, './node_modules/react-image-file-resizer'),
'react-toastify': path.resolve(__dirname, './node_modules/react-toastify'),
'react-twitter-embed': path.resolve(__dirname, './node_modules/react-twitter-embed'),
'emoji-picker-react': path.resolve(__dirname, './node_modules/emoji-picker-react'),
'gif-picker-react': path.resolve(__dirname, './node_modules/gif-picker-react'),
'@unstoppabledomains/resolution': path.resolve(__dirname, './node_modules/@unstoppabledomains/resolution'),
'react-player': path.resolve(__dirname, './node_modules/react-player'),
animejs: path.resolve(__dirname, './node_modules/animejs'),
raf: path.resolve(__dirname, './node_modules/raf'),
classnames: path.resolve(__dirname, './node_modules/classnames'),
protobufjs: path.resolve(__dirname, './node_modules/protobufjs'),
'@livepeer/react': path.resolve(__dirname, './node_modules/@livepeer/react'),
'@livekit/components-react': path.resolve(__dirname, './node_modules/@livekit/components-react'),
'livekit-client': path.resolve(__dirname, './node_modules/livekit-client'),
};
}
export default defineConfig({
resolve: {
alias: {
// Define aliases for specific libraries (@uniswap/widgets is importing it with '~' and vite can't resolve it)
'~@fontsource/ibm-plex-mono': '@fontsource/ibm-plex-mono',
'~@fontsource/inter': '@fontsource/inter',
// Add more aliases as needed
...addedAlias,
jsbi: path.resolve(__dirname, 'node_modules/jsbi'),
},
},
plugins: [
topLevelAwait(),
react(),
svgr(),
viteTsconfigPaths({
root: './',
}),
nodePolyfills(),
vitePluginRequire.default(),
],
define: {
global: 'globalThis',
},
server: {
// this ensures that the browser opens upon server start
// open: true,
// this sets a default port to 3000
port: 3000,
},
build: {
outDir: 'build',
sourcemap: false,
},
}); After applying these corrections, the code should be error-free. |
In the
In the
In the
Please address the mentioned issues. |
In the
In the
In the
In the Overall, there are some syntax errors and missing dependencies that need to be addressed. |
In dev-mode-link-local-sdk.mjs:
In package.json:
In App.tsx:
In Recommended.tsx:
All looks good. |
Code Review Findings:
Overall, the code seems to have minor issues and typos. Please address the mentioned points. All looks good. |
src/App.tsx
Outdated
@@ -277,7 +279,7 @@ export default function App() { | |||
<ChatUIProvider | |||
user={userPushSDKInstance} | |||
theme={darkMode && darkChatTheme} | |||
debug={true} | |||
debug={pushsdkDebug} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug={pushsdkDebug} | |
debug={true} |
It's fine this way as we are not using it anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected debug logic, should be debug true or false based on dev testing but should revert to false for prod environment
"@pushprotocol/socket": "0.5.3", | ||
"@pushprotocol/uiweb": "1.2.11", | ||
"@pushprotocol/uiweb": "1.3.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request heading says using uiweb alpha and the version is changed here. What's the correct expected version here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was publishing alpha but changes are made to stable release as well so switched to the latest version
<ItemHV2> | ||
{/* Set active and onCLick to customize tab */} | ||
<TabButton | ||
active={activeTab == 0 ? true : false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
active={activeTab == 0 ? true : false} | |
active={!activeTab} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activeTab is not a boolean, might get hard to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, know that but instead of exact number specific checks we could use the javascripts behaviour to consider 0 as a falsy value and shorten our code.
</TabButton> | ||
|
||
<TabButton | ||
active={activeTab == 1 ? true : false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
active={activeTab == 1 ? true : false} | |
active={!!activeTab} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a boolean, but will go with what you suggest
flex="initial" | ||
fontSize="16px" | ||
fontWeight="400" | ||
color={activeTab === 1 ? GLOBALS.COLORS.PRIMARY_PINK : 'inherit'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color={activeTab === 1 ? GLOBALS.COLORS.PRIMARY_PINK : 'inherit'} | |
color={activeTab ? GLOBALS.COLORS.PRIMARY_PINK : 'inherit'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will result it activeTab color to be pink even when search is active, since activeTab can be 0 - 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
</ItemHV2> | ||
</ItemVV2> | ||
)} | ||
{numberOfChatReqs === -1 || requestLoadingData?.loading ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{numberOfChatReqs === -1 || requestLoadingData?.loading ? ( | |
{numberOfChatReqs < 0 || requestLoadingData?.loading ? ( |
In the file dev-mode-link-local-sdk.mjs:
It seems there are some missing pieces in the code provided. If the missing parts are fulfilling the logic elsewhere, please ensure to address them accordingly. Otherwise, the previously mentioned issues need to be resolved for the code to work correctly. All looks good. |
Enables Video and Frames functionality, test group here: (http://localhost:3000/chat/chatid:076b41e6820af9e859cc6c5cc22e350ce329fa1830623c993c544614050cf83b)
Enables code block functionality: (http://localhost:3000/chat/0x71Ffa5771E8019787190D098586EFe02026a3c8C), try asking
give me sample code to integrate push notifications
Adjusts scrollbar to the far right for ChatSidebar and ChatViewList, adjust padding to come from themized object for ChatView, ChatViewList, ChatBubble, ChatPreview, MessageInputBar, ChatPreviewList and ChatPreview