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

UI/webinar: Webinar page using dyte implementation #285

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

nxtCoder19
Copy link
Contributor

@nxtCoder19 nxtCoder19 commented Sep 3, 2024

Summary by Sourcery

Implement a new webinar page using Dyte SDK, including components for joining webinars and displaying meeting UI. Add a footer component with social media links and navigation menu. Introduce a theme switcher component. Add build and CI configurations, including a pnpm-lock.yaml for dependencies and an ESLint configuration for code quality. Provide documentation for getting started and deploying the application.

New Features:

  • Introduce a new webinar page using Dyte SDK for managing meetings, including components for joining webinars and displaying meeting UI.
  • Add a new footer component for the webinar application with social media links and navigation menu.
  • Implement a theme switcher component to toggle between light, dark, and system themes.

Enhancements:

  • Refactor import statements in existing components for better organization and consistency.

Build:

  • Add a pnpm-lock.yaml file to manage dependencies for the webinar application.
  • Include a Taskfile.yaml for building and deploying Docker containers for the webinar application.

CI:

  • Add an ESLint configuration file (.eslintrc.yml) for the webinar application to enforce coding standards and integrate with TypeScript.

Documentation:

  • Create a README.md file for the webinar application with instructions on how to get started, learn more, and deploy the application.

Copy link

gitguardian bot commented Sep 3, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link

sourcery-ai bot commented Sep 3, 2024

Reviewer's Guide by Sourcery

This pull request introduces a new webinar page using the Dyte SDK, along with several supporting components and configurations. Key changes include the addition of a pnpm lock file, ESLint configuration, and various React components for the webinar app. The implementation also involves setting up Tailwind CSS for styling and configuring Next.js for environment management.

File-Level Changes

Change Details Files
Reorganized imports for better readability and consistency.
  • Moved 'Button' import to a different position.
  • Reordered imports to maintain a consistent style.
src/apps/devdoc/web/components/toc.tsx
src/apps/auth/components/footer.tsx
Updated URL parameter handling in login redirection.
  • Changed query parameter from 'encodedData' to 'userData'.
src/apps/auth/routes/_providers+/login.tsx
Added a new pnpm lock file for dependency management.
  • Created a new pnpm-lock.yaml file with detailed dependencies.
src/apps/webinar/pnpm-lock.yaml
Introduced ESLint configuration for the webinar app.
  • Added .eslintrc.yml with specific rules and plugins for TypeScript and React.
src/apps/webinar/.eslintrc.yml
Implemented a new footer component for the webinar app.
  • Created a new footer component with social media links and a menu.
src/apps/webinar/src/app/components/footer.tsx
Developed a new page for joining webinars using Dyte SDK.
  • Created a page component that initializes a Dyte meeting client.
  • Handles meeting joining logic with API calls.
src/apps/webinar/src/app/pages/meeting/page.tsx
Added a README file for the webinar app.
  • Provided instructions for starting the development server and deploying the app.
src/apps/webinar/README.md
Configured task automation using Taskfile.
  • Defined tasks for building and starting the app, as well as Docker container operations.
src/apps/webinar/Taskfile.yaml
Added global styles using Tailwind CSS.
  • Configured Tailwind CSS for global styles in the webinar app.
src/apps/webinar/src/app/globals.css
Created a header component for the webinar app.
  • Implemented a header with a brand logo and optional extra content.
src/apps/webinar/src/app/components/header.tsx
Implemented a component for joining webinars.
  • Created a component that decodes user data and redirects to a meeting page.
src/apps/webinar/src/app/components/join-webinar.tsx
Added a container component for layout purposes.
  • Implemented a container component that includes a header and main content area.
src/apps/webinar/src/app/components/container.tsx
Set up TypeScript configuration for the webinar app.
  • Configured TypeScript with specific compiler options and paths.
src/apps/webinar/tsconfig.json
Developed the main page for the webinar app.
  • Created the main page layout with a call to action to join the webinar.
src/apps/webinar/src/app/page.tsx
Added a theme switcher component.
  • Implemented a theme switcher with options for light, dark, and system themes.
src/apps/webinar/src/app/components/theme-switcher.tsx
Created a wrapper component for consistent layout.
  • Implemented a wrapper component to standardize padding and width across the app.
src/apps/webinar/src/app/components/wrapper.tsx
Set up the root layout for the webinar app.
  • Configured the root layout with global styles and metadata.
src/apps/webinar/src/app/layout.tsx
Configured Tailwind CSS for the webinar app.
  • Set up Tailwind CSS configuration with content paths and theme extensions.
src/apps/webinar/tailwind.config.ts
Implemented a custom meeting UI using Dyte SDK.
  • Created a custom meeting UI component using Dyte's React UI kit.
src/apps/webinar/src/app/orgs/my-meeting-ui.tsx
Configured Next.js for the webinar app.
  • Set up Next.js configuration with environment variables.
src/apps/webinar/next.config.mjs
Configured PostCSS for the webinar app.
  • Set up PostCSS configuration with Tailwind CSS as a plugin.
src/apps/webinar/postcss.config.mjs

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nxtCoder19 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟡 Documentation: 2 issues found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

import { Link } from '@remix-run/react';
import { Button } from 'kl-design-system/atoms/button';
import { BrandLogo } from 'kl-design-system/branding/brand-logo';
// import { mainUrl } from '../consts';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Remove commented out code

Consider removing the commented out import statement. If it's not needed, it's better to delete it entirely rather than leaving it as a comment to keep the codebase clean.

@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): Consider adding a brief introduction about the webinar app.

While the general Next.js information is helpful, it would be beneficial to include a short description of the webinar app's purpose and functionality at the beginning of the README.

Suggested change
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Webinar App
This is a webinar application built with Next.js, designed to facilitate online seminars and interactive presentations. It offers features for hosting, scheduling, and participating in webinars.
This project is bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) using [Next.js](https://nextjs.org/).

@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): Consider adding webinar app-specific setup instructions.

If there are any specific configuration steps or requirements for the webinar app, it would be helpful to include them in the 'Getting Started' section.

## Getting Started

### Webinar App Setup

1. Configure environment variables:
   - Copy `.env.example` to `.env.local`
   - Set `WEBINAR_API_KEY` and other required variables

2. Install dependencies:

npm install


3. Run the development server:

import { useEffect, useState } from 'react';
import { MyMeetingUI } from '../../orgs/my-meeting-ui';

export default function App() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (complexity): Consider refactoring the code to improve modularity and separation of concerns.

While the current implementation works, we can improve its readability and maintainability without over-engineering. Here are some suggestions:

  1. Extract the API call into a separate function:
const joinMeeting = async (name, email, meetingId) => {
  const token = btoa(`${process.env.NEXT_PUBLIC_DYTE_ORG_ID}:${process.env.NEXT_PUBLIC_DYTE_API_KEY}`);
  try {
    const { data: { success, data } } = await axios.post(
      `https://api.dyte.io/v2/meetings/${meetingId}/participants`,
      {
        name,
        picture: "https://i.imgur.com/test.jpg",
        preset_name: "webinar_viewer",
        custom_participant_id: email,
      },
      {
        headers: {
          Authorization: `Basic ${token}`,
        },
      }
    );
    if (!success) {
      throw new Error('Failed to join meeting');
    }
    return data.token;
  } catch (error) {
    console.error('Error joining meeting:', error);
    throw error;
  }
};
  1. Create a custom hook for Dyte client initialization:
const useDyteInitialization = (authToken) => {
  const [meeting, initMeeting] = useDyteClient();

  useEffect(() => {
    if (authToken) {
      initMeeting({
        authToken: authToken,
        defaults: {
          audio: false,
          video: false,
        },
      });
    }
  }, [authToken, initMeeting]);

  return meeting;
};
  1. Simplify the main component:
export default function App() {
  const [authToken, setAuthToken] = useState('');
  const params = useSearchParams();
  const meeting = useDyteInitialization(authToken);

  useEffect(() => {
    const meetingId = params.get('meetingId');
    const name = params.get('name');
    const email = params.get('email');

    if (meetingId && name && email) {
      joinMeeting(name, email, meetingId)
        .then(setAuthToken)
        .catch(error => console.error('Failed to join meeting:', error));
    }
  }, [params]);

  return (
    <DyteProvider value={meeting}>
      <MyMeetingUI />
    </DyteProvider>
  );
}

These changes maintain the overall structure while improving readability and potential reusability. The API call logic is now in a separate function, making it easier to test and modify. The Dyte client initialization is in a custom hook, which could be reused if needed. The main component is now more focused on orchestrating the meeting join flow.

Remember to add appropriate error handling and consider adding comments to explain the flow if it's not immediately clear from the code structure.

@nxtCoder19 nxtCoder19 merged commit 3d035b3 into update/cluster-status Sep 3, 2024
3 checks passed
@nxtCoder19 nxtCoder19 deleted the ui/webinar branch September 3, 2024 13:30
abdheshnayak pushed a commit that referenced this pull request Oct 28, 2024
UI/webinar: Webinar page using dyte implementation
tulsiojha pushed a commit that referenced this pull request Nov 1, 2024
UI/webinar: Webinar page using dyte implementation
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
UI/webinar: Webinar page using dyte implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant