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

Mvp #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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
50 changes: 40 additions & 10 deletions src/features/chat/ChatDashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import React from "react";
import { Grid, Segment, Input, Message, Icon } from "semantic-ui-react";
import {
Grid,
Segment,
Input,
Message,
Icon,
Search,
Card,
Image,
} from "semantic-ui-react";
export default function ChatDashboard() {
return (
<Grid>
<Grid.Column width={4}>
<h1>Chats</h1>
<Grid.Column width={3}>
<Search />
<Segment.Group raised>
<Segment>Top</Segment>
<Segment>Middle</Segment>
<Segment>Middle</Segment>
<Segment>Middle</Segment>
<Segment>Bottom</Segment>
<Segment>Staff 1</Segment>
<Segment>Staff 2</Segment>
<Segment>Student 1</Segment>
<Segment>Student 2</Segment>
<Segment>Group 1</Segment>
</Segment.Group>
</Grid.Column>
<Grid.Column width={12}>
<h1>Chat</h1>
<Grid.Column width={10}>
<Segment.Group>
<div>
<Segment color="red">
Expand Down Expand Up @@ -51,6 +59,28 @@ export default function ChatDashboard() {
</div>
</Segment.Group>
</Grid.Column>
<Grid.Column width={3}>
<Segment>
<Card>
<Image
src="https://react.semantic-ui.com/images/avatar/large/matthew.png"
wrapped
ui={false}
/>
<Card.Content>
<Card.Header>Ravi</Card.Header>
<Card.Meta>
<span className="date">(4/4) IT B</span>
</Card.Meta>
<Card.Description>Ravi is a colleague.</Card.Description>
</Card.Content>
</Card>
<h4>Files shared</h4>
<Card.Meta>
<span>None</span>
</Card.Meta>
</Segment>
</Grid.Column>
</Grid>
);
}
140 changes: 76 additions & 64 deletions src/features/events/eventDashboard/EventDashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,70 +1,82 @@
import React , { useState } from 'react'
import { Grid, Container, Segment } from 'semantic-ui-react'
import EventList from './EventList'
import EventListItemPlaceholder from './EventListItemPlaceholder';
import EventFilters from './EventFilters';
import { listenToEventsFromFirestore } from '../../../app/firestore/firestoreService';
import { listenToEvents } from '../eventActions';
import useFirestoreCollection from '../../../app/hooks/useFirestoreCollection';
import { useSelector, useDispatch } from 'react-redux';
import React, { useState } from "react";
import { Grid, Container, Segment } from "semantic-ui-react";
import EventList from "./EventList";
import EventListItemPlaceholder from "./EventListItemPlaceholder";
import EventFilters from "./EventFilters";
import { listenToEventsFromFirestore } from "../../../app/firestore/firestoreService";
import { listenToEvents } from "../eventActions";
import useFirestoreCollection from "../../../app/hooks/useFirestoreCollection";
import { useSelector, useDispatch } from "react-redux";

export default function EventDashboard() {
const dispatch = useDispatch();
const { events } = useSelector((state) => state.event);
const { loading } = useSelector((state) => state.async);
const [predicate, setPredicate] = useState(
new Map([
['startDate', new Date()],
['filter', 'all'],
])
);

function handleSetPredicate(key, value) {
setPredicate(new Map(predicate.set(key, value)));
}
const dispatch = useDispatch();
const { events } = useSelector((state) => state.event);
const { loading } = useSelector((state) => state.async);
const [predicate, setPredicate] = useState(
new Map([
["startDate", new Date()],
["filter", "all"],
])
);

useFirestoreCollection({
query: () => listenToEventsFromFirestore(predicate),
data: (events) => dispatch(listenToEvents(events)),
deps: [dispatch , predicate],
});
function handleSetPredicate(key, value) {
setPredicate(new Map(predicate.set(key, value)));
}

return (
<Grid>
<Grid.Column width={2}>
<h2>Hello Menu</h2>
</Grid.Column>
<Grid.Column width={10} >
<h1>MVSR ENGINEERING COLLEGE</h1>
<Segment raised center>
<h2>Welcome</h2>
<Container>
<p>Here are the recent most events that took place in our college</p>
</Container>
</Segment>
useFirestoreCollection({
query: () => listenToEventsFromFirestore(predicate),
data: (events) => dispatch(listenToEvents(events)),
deps: [dispatch, predicate],
});

{loading && (
<>
<EventListItemPlaceholder />
<EventListItemPlaceholder />
</>
)}
<EventList events={events}/>
</Grid.Column>
<Grid.Column width={4}>
<h1>New notification column</h1>
<Segment raised>
College Events.
<ul>
<li>OU Exam fee</li>
<li>Declaration of Summer Vacation: Circular 06-05-2021</li>
<li>Sewing Machine Project Executed by the members of Street Cause MVSREC - Telecasted on I News TV Channel</li>
<li>Re-Admission of students during the academic year 2020-21</li>
<li>Operating Manuals for Students and Institutions - AICTE Pragati and Saksham Schemes - Click Here</li>
</ul>
</Segment>
<EventFilters predicate={predicate} setPredicate={handleSetPredicate} loading={loading} />
</Grid.Column>
</Grid>
)
return (
<Grid>
<Grid.Column width={2}>
<h2>Hello Menu</h2>
</Grid.Column>
<Grid.Column width={10}>
<h1>MVSR ENGINEERING COLLEGE</h1>
<Segment raised center>
<h2>Welcome(Put in center)</h2>
<Container>
<p>
Here are the recent most events that took place in our college
</p>
</Container>
</Segment>

{loading && (
<>
<EventListItemPlaceholder />
<EventListItemPlaceholder />
</>
)}
<EventList events={events} />
</Grid.Column>
<Grid.Column width={4}>
<h1>New notification column</h1>
<Segment raised>
College Events.
<ul>
<li>OU Exam fee</li>
<li>Declaration of Summer Vacation: Circular 06-05-2021</li>
<li>
Sewing Machine Project Executed by the members of Street Cause
MVSREC - Telecasted on I News TV Channel
</li>
<li>Re-Admission of students during the academic year 2020-21</li>
<li>
Operating Manuals for Students and Institutions - AICTE Pragati
and Saksham Schemes - Click Here
</li>
</ul>
</Segment>
<EventFilters
predicate={predicate}
setPredicate={handleSetPredicate}
loading={loading}
/>
</Grid.Column>
</Grid>
);
}