Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Braun committed Jan 23, 2024
2 parents f335e56 + 4e66244 commit a3950da
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 92 deletions.
33 changes: 16 additions & 17 deletions components/chat/Chat.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import React, { useState } from 'react';
import { IMessage } from '@common/types/messages';

import _ from 'lodash';

function Chat() {
const [messages, setMessages] = useState<IMessage[]>([]);
// const [messages, setMessages] = useState<IMessage[]>([]);
const [messageInput, setMessageInput] = useState('');
const [currentUser, setCurrentUser] = useState('User1');
const handleSend = () => {
// append the new message to the current list of messages
setMessages((messages) => [
...messages,
{ user: currentUser, message: messageInput, timestamp: new Date() },
]);
// clear the input field
setMessageInput('');
};
const handleUserChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setCurrentUser(event.target.value);
};
const [label, setLab] = useState('Standart');
// const [currentUser, setCurrentUser] = useState('User1');
// const handleSend = () => {
// // append the new message to the current list of messages
// setMessages((messages) => [
// ...messages,
// { user: currentUser, message: messageInput, timestamp: new Date() },
// ]);
// // clear the input field
// setMessageInput('');
// };
// const handleUserChange = (event: React.ChangeEvent<HTMLInputElement>) => {
// setCurrentUser(event.target.value);
// };
// const [label, setLab] = useState('Standart');
return (
<div className="pl-4 h-full">
<div className="relative right-2 ">
Expand All @@ -33,7 +32,7 @@ function Chat() {
<button
className="absolute top-0 appearance-none right-0 border-inherit outline-none p-2.5 text-sm font-medium text-white"
onClick={() => {
if (messageInput) handleSend();
// if (messageInput) handleSend();
}}
></button>
</div>
Expand Down
1 change: 0 additions & 1 deletion components/common/Layout/Layout.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Meta, StoryFn } from '@storybook/react';
import { Fragment } from 'react';
import { Layout as Lay } from './Layout';

export default {
Expand Down
28 changes: 10 additions & 18 deletions components/common/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import React from 'react';
import { Fragment, useState } from 'react';
import { Dialog, Transition } from '@headlessui/react';
import {
Bars3Icon,
DocumentDuplicateIcon,
FolderIcon,
HomeIcon,
UsersIcon,
XMarkIcon,
} from '@heroicons/react/24/outline';
import { Bars3Icon, UsersIcon, XMarkIcon } from '@heroicons/react/24/outline';

import { useAppSelector } from 'redux/store';
import { usePathname } from 'next/navigation';
import WorkspacesBar from '@components/ui/workspacesBar';
import AddServerModal from '@components/ui/AddServer';
Expand All @@ -33,9 +25,9 @@ function classNames(...classes: any) {
export const Layout = ({ children }: Props) => {
const [sidebarOpen, setSidebarOpen] = useState(false);
const [addServerOpen, setAddServerOpen] = useState(false);
const currentUsedSessionCid: string = useAppSelector(
(state) => state.context.sessions.current_used_session_server
);
// const currentUsedSessionCid: string = useAppSelector(
// (state) => state.context.sessions.current_used_session_server
// );

const pathname = usePathname();
console.log(pathname);
Expand All @@ -48,13 +40,13 @@ export const Layout = ({ children }: Props) => {
},
]);

const current_sessions = useAppSelector(
(state) => state.context.sessions.current_sessions
);
// const current_sessions = useAppSelector(
// (state) => state.context.sessions.current_sessions
// );

const peers = Object.keys(
current_sessions[currentUsedSessionCid] ?? {}
).length;
// const peers = Object.keys(
// current_sessions[currentUsedSessionCid] ?? {}
// ).length;

return (
<>
Expand Down
50 changes: 16 additions & 34 deletions components/common/Layout/StartLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,16 @@
import React from 'react';
import { Fragment, useState } from 'react';
import { Dialog, Menu, Transition } from '@headlessui/react';
import { Dialog, Transition } from '@headlessui/react';
import {
Bars3Icon,
BellIcon,
CalendarIcon,
ChartPieIcon,
ChevronDownIcon,
Cog6ToothIcon,
DocumentDuplicateIcon,
FolderIcon,
HomeIcon,
MagnifyingGlassIcon,
UsersIcon,
XMarkIcon,
} from '@heroicons/react/24/outline';

import { useAppSelector } from 'redux/store';
import { usePathname } from 'next/navigation';
import WorkspacesBar from '@components/ui/workspacesBar';
import AddServerModal from '@components/ui/AddServer';

const navigation = [
{ name: 'Dashboard', href: '#', icon: HomeIcon, current: true },
{ name: 'Team', href: '#', icon: UsersIcon, current: false },
{ name: 'Projects', href: '#', icon: FolderIcon, current: false },
{ name: 'Calendar', href: '#', icon: CalendarIcon, current: false },
{ name: 'Documents', href: '#', icon: DocumentDuplicateIcon, current: false },
{ name: 'Reports', href: '#', icon: ChartPieIcon, current: false },
];
const teams = [
{ id: 1, name: 'Heroicons', href: '#', initial: 'H', current: false },
{ id: 2, name: 'Tailwind Labs', href: '#', initial: 'T', current: false },
Expand All @@ -46,19 +28,19 @@ function classNames(...classes: any) {
export const Layout = ({ children }: Props) => {
const [sidebarOpen, setSidebarOpen] = useState(false);
const [addServerOpen, setAddServerOpen] = useState(false);
const currentUsedSessionCid: string = useAppSelector(
(state) => state.context.sessions.current_used_session_server
);
// const currentUsedSessionCid: string = useAppSelector(
// (state) => state.context.sessions.current_used_session_server
// );

const pathname = usePathname();
console.log(pathname);
const [navigation, _] = useState([
{
name: 'Find Peers',
href: `/server/findPeers/`,
icon: UsersIcon,
current: true,
},
// {
// name: 'Find Peers',
// href: `/server/findPeers/`,
// icon: UsersIcon,
// current: true,
// },
{
name: 'Storage',
href: '/server/storage/',
Expand All @@ -67,13 +49,13 @@ export const Layout = ({ children }: Props) => {
},
]);

const current_sessions = useAppSelector(
(state) => state.context.sessions.current_sessions
);
// const current_sessions = useAppSelector(
// (state) => state.context.sessions.current_sessions
// );

const peers = Object.keys(
current_sessions[currentUsedSessionCid] ?? {}
).length;
// const peers = Object.keys(
// current_sessions[currentUsedSessionCid] ?? {}
// ).length;

return (
<>
Expand Down
4 changes: 1 addition & 3 deletions components/ui/AddServer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { RootState } from 'redux/store';
import { Dispatch, SetStateAction, useState } from 'react';
import { useSelector } from 'react-redux';

export default function AddServerModal({
onCloseNavbar,
Expand All @@ -13,7 +11,7 @@ export default function AddServerModal({

// const register = useRegister_c2s();

const { uuid } = useSelector((state: RootState) => state.uuid);
// const { uuid } = useSelector((state: RootState) => state.uuid);

const [fullName, setFullName] = useState('');
const [username, setUsername] = useState('');
Expand Down
2 changes: 1 addition & 1 deletion components/ui/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface StateValues {
}

const stateModifiers = {
setUuid: (payload: string) => {},
setUuid: (_payload: string) => {},
};

const initialState = { uuid: '' };
Expand Down
5 changes: 2 additions & 3 deletions components/ui/workspacesBar/WorkspaceBar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { Meta, StoryFn } from '@storybook/react';
import type { Meta } from '@storybook/react';

import WorkspaceBar from './WorkspaceBar';
import { SetStateAction } from 'react';

export default {
title: 'Components/ Bar',
component: WorkspaceBar,
} as Meta;

export const Bar: StoryFn = () => <WorkspaceBar onOpen={() => {}} />;
// export const Bar: StoryFn = () => <WorkspaceBar />;
2 changes: 1 addition & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function CustomApp({
Component,
pageProps,
}: AppProps & { Component: { Layout: FC<{ children: ReactNode }> } }) {
const [connErr, setErr] = useState('');
const [_connErr, setErr] = useState('');

useEffect(() => {
const connect = async () => {
Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import genUuid from '@lib/utils';
import store from '@redux/store';
import { addToContext } from '@redux/slices/streamHandler.slice';

export default function Home({ connErr }: { connErr: string }) {
export default function Home() {
return (
<>
<div className="flex flex-col justify-between no-">
Expand Down
1 change: 0 additions & 1 deletion pages/server/[serverCid].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Layout } from '@components/common/Layout';
import useListAllPeers from '@hooks/c2s/useListAllPeers';
const Server = () => {
return (
<div className="text-4xl text-teal-50 text-center h-[calc(100vh-5.5rem)] select-none">
Expand Down
9 changes: 4 additions & 5 deletions pages/settings/plans.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Fragment } from 'react';
import { CheckIcon, MinusIcon } from '@heroicons/react/20/solid';
import Link from 'next/link';

const tiers = [
Expand Down Expand Up @@ -154,7 +153,7 @@ export default function Example() {
{sections.map((section) => (
<li key={section.name}>
<ul role="list" className="space-y-4">
{section.features.map((feature) =>
{/* {section.features.map((feature) =>
feature.tiers[tier.name] ? (
<li key={feature.name} className="flex gap-x-3">
<CheckIcon
Expand All @@ -171,7 +170,7 @@ export default function Example() {
</span>
</li>
) : null
)}
)} */}
</ul>
</li>
))}
Expand Down Expand Up @@ -277,7 +276,7 @@ export default function Example() {
</th>
{tiers.map((tier) => (
<td key={tier.id} className="px-6 py-4 xl:px-8">
{typeof feature.tiers[tier.name] === 'string' ? (
{/* {typeof feature.tiers[tier.name] === 'string' ? (
<div className="text-center text-sm leading-6 text-gray-300">
{feature.tiers[tier.name]}
</div>
Expand All @@ -302,7 +301,7 @@ export default function Example() {
in {tier.name}
</span>
</>
)}
)} */}
</td>
))}
</tr>
Expand Down
4 changes: 1 addition & 3 deletions pages/storage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Layout } from '@components/common/Layout';
import React from 'react';
import { useSelector } from 'react-redux';
import { RootState } from 'redux/store';

export default function Storage() {
const { uuid } = useSelector((state: RootState) => state.uuid);
// const { uuid } = useSelector((state: RootState) => state.uuid);
// const upload = (e: any) => {
// const arr: string[] = [];
// Array.from(e.target.files).forEach((file: any) => {
Expand Down
4 changes: 0 additions & 4 deletions src-tauri/.cargo/config.toml

This file was deleted.

0 comments on commit a3950da

Please sign in to comment.