Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 97 additions & 29 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,110 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
/* Main container for the chat application */
.lm-chat-container {
width: 100vw !important;
height: 100vh !important;
display: flex !important;
justify-content: center !important;
align-items: center !important;
background-color: #f0f2f5 !important; /* Light grey background for the overall app */
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
/* Custom styling for various header components to ensure consistency */

/* Main chatroom header */
.lm-channel-header {
background-color: #4a90e2 !important; /* Example blue background */
color: #ffffff !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Adjust text color for elements within the main chatroom header */
.lm-channel-header .lm-channel-title {
color: #ffffff !important;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);

.lm-channel-header .lm-channel-desc {
color: #e0e0e0 !important;
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);

.lm-channel-header .lm-channel-icon {
color: #ffffff !important;
}

/* Search conversation header (appears when search is active in a chatroom) */
.lm-conversation-search {
background-color: #4a90e2 !important; /* Match main header background */
color: #ffffff !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Adjust text color for elements within the search conversation header */
.lm-conversation-search .lm-conversation-search-input-field {
color: #ffffff !important;
background-color: rgba(255, 255, 255, 0.2) !important;
border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.lm-conversation-search .lm-conversation-search-input-field::placeholder {
color: #e0e0e0 !important;
}

.lm-conversation-search .lm-conversation-search-go-back-icon {
color: #ffffff !important;
}

/* Channel list header (left panel header) */
.lm-channel-list-header {
background-color: #3a7bd5 !important; /* Slightly darker blue for channel list header */
color: #ffffff !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Adjust text color for elements within the channel list header */
.lm-channel-list-header .title {
color: #ffffff !important;
}

.lm-channel-list-header .icon {
color: #ffffff !important;
}

/* Chatroom search header (appears when searching in the channel list) */
.lm-chatroom-search {
background-color: #3a7bd5 !important; /* Match channel list header background */
color: #ffffff !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Adjust text color for elements within the chatroom search header */
.lm-chatroom-search .lm-chatroom-search-input-field {
color: #ffffff !important;
background-color: rgba(255, 255, 255, 0.2) !important;
border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.lm-chatroom-search .lm-chatroom-search-input-field::placeholder {
color: #e0e0e0 !important;
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.lm-chatroom-search .lm-chatroom-search-go-back-icon {
color: #ffffff !important;
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
/* General chat box styling */
.lm-chat-box {
background-color: #ffffff !important;
border-radius: 8px !important;
overflow: hidden !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.card {
padding: 2em;
/* Ensure the main channel block takes full height and width */
.lm-channel-block {
width: 100% !important;
height: 100% !important;
}

.read-the-docs {
color: #888;
/* Adjust the right panel to take available width */
.lm-right-panel {
flex: 1 !important;
}
66 changes: 36 additions & 30 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import { useState } from "react";
import {
LMClientOverlayProvider,
LMChannel,
initiateLMClient,
LMChatTheme,
} from "@likeminds.community/likeminds-chat-reactjs";
import "./App.css"; // Ensure this import is present for custom styles

function App() {
const [count, setCount] = useState(0)
// Initialize the LikeMinds Chat Client outside the component to avoid re-initialization
const lmChatClient = initiateLMClient();

function ChatApp() {
// Replace with your actual API Key, UUID, and Username
// For production, consider fetching these securely from your backend
const [userDetails] = useState<{
apiKey?: string;
uuid?: string;
username?: string;
}>(
{
apiKey: "aca40392-f386-4c58-b9dd-7f59a50de207", // <<< IMPORTANT: Replace with your actual API Key
uuid: "16d8bc72-6b1a-4773-9832-3237e1ca5597", // <<< IMPORTANT: Replace with your actual User UUID
username: "TestUser", // <<< IMPORTANT: Replace with your actual Username
}
);

return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
<div className="lm-chat-container">
<LMClientOverlayProvider
client={lmChatClient}
userDetails={userDetails}
lmChatTheme={LMChatTheme.COMMUNITY_HYBRID_CHAT} // Using hybrid theme for both group and DMs
>
<LMChannel />
</LMClientOverlayProvider>
</div>
);
}

export default App
export default ChatApp;
75 changes: 13 additions & 62 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,68 +1,19 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}

/* Basic global styles */
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}

h1 {
font-size: 3.2em;
line-height: 1.1;
margin: 0 !important;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif !important;
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
}

button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace !important;
}

@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
/* Ensure box-sizing is consistent */
*, *::before, *::after {
box-sizing: border-box !important;
}
13 changes: 8 additions & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
import ChatApp from './App.tsx'; // Renamed App to ChatApp
import './index.css';
import { BrowserRouter } from 'react-router-dom';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
<Router>
<Routes>
{/* Make the ChatApp the default route */}
<Route path="/" element={<ChatApp />} />
</Routes>
</Router>
</React.StrictMode>,
);