From 1503ddeda410c61c6169240d4f0167295a741f62 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 10 Jun 2025 17:32:18 +0530 Subject: [PATCH] feat: remove unused files --- .../src/components/HelloWorld.jsx | 49 -------- .../src/components/VueWebComponentWrapper.jsx | 106 ------------------ 2 files changed, 155 deletions(-) delete mode 100644 app/javascript/react-components/src/components/HelloWorld.jsx delete mode 100644 app/javascript/react-components/src/components/VueWebComponentWrapper.jsx diff --git a/app/javascript/react-components/src/components/HelloWorld.jsx b/app/javascript/react-components/src/components/HelloWorld.jsx deleted file mode 100644 index bdad263b8..000000000 --- a/app/javascript/react-components/src/components/HelloWorld.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import React, { useState } from 'react'; - -export const HelloWorld = () => { - const [count, setCount] = useState(0); - - return ( -
-

Hello from Chatwoot React!

-

Count: {count}

- - -
- ); -}; \ No newline at end of file diff --git a/app/javascript/react-components/src/components/VueWebComponentWrapper.jsx b/app/javascript/react-components/src/components/VueWebComponentWrapper.jsx deleted file mode 100644 index 43a4d1fb8..000000000 --- a/app/javascript/react-components/src/components/VueWebComponentWrapper.jsx +++ /dev/null @@ -1,106 +0,0 @@ -import React, { useEffect, useRef, useState } from 'react'; -import { registerVueWebComponents } from '../vue-components/registerWebComponents'; - -export const VueWebComponentWrapper = ({ - initialCount = 0, - title = 'Hello from Vue in React!', - color = '#42b883', - ...otherProps -}) => { - const elementRef = useRef(); - const [isReady, setIsReady] = useState(false); - const [currentCount, setCurrentCount] = useState(initialCount); - - // Register Web Components on mount - useEffect(() => { - registerVueWebComponents(); - setIsReady(true); - - // Listen for custom events from Vue component - const handleCountChange = event => { - setCurrentCount(event.detail.count); - console.log('Vue component count changed:', event.detail.count); - }; - - document.addEventListener('vue-counter-changed', handleCountChange); - - return () => { - document.removeEventListener('vue-counter-changed', handleCountChange); - }; - }, []); - - // Update Web Component properties when React props change - useEffect(() => { - if (!isReady || !elementRef.current) return; - - const element = elementRef.current; - - // Set properties on the Web Component - // Vue converts camelCase props to kebab-case attributes - element.setAttribute('initial-count', initialCount); - element.setAttribute('title', title); - element.setAttribute('color', color); - - console.log('Updated Vue Web Component props:', { - initialCount, - title, - color, - }); - }, [isReady, initialCount, title, color]); - - if (!isReady) { - return ( -
- Loading Vue Web Component... -
- ); - } - - return ( -
-
- React Wrapper Info: Current count tracked by React:{' '} - {currentCount} -
- - {/* This is the Vue Web Component rendered inside React */} - - -
- ✅ This Vue component is running as a Web Component inside React! -
-
- ); -};