Skip to content

Commit

Permalink
add in drop down menu, remove menu options from profile
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswebb09 committed Dec 15, 2023
1 parent 1ba99c8 commit 7d10ffc
Show file tree
Hide file tree
Showing 18 changed files with 242 additions and 137 deletions.
27 changes: 9 additions & 18 deletions DirectReport/browserview/app.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
#!/usr/bin/env python3

import sys
from pathlib import Path

from flask import Flask, render_template, request, redirect, json, url_for
from werkzeug.security import generate_password_hash
from DirectReport.models.user_model import UserModel
from DirectReport.models.list_builder import ListBuilder
from DirectReport.models.report_model import ReportModel
from DirectReport.models.report_builder import ReportBuilder
from DirectReport.models.report import Report
from DirectReport.browserview.prompt_logic import generate_email
from flask_login import LoginManager, login_required, current_user

from DirectReport.browserview.github import GithubClient
from DirectReport.browserview.github import GoogleAIClient
from DirectReport.browserview.github import HuggingFaceClient
from flask_login import LoginManager, login_user, login_required, logout_user, current_user
from DirectReport.browserview.prompt_logic import generate_email
from DirectReport.datadependencies import appsecrets
from DirectReport.models.user_model import UserModel
from .auth.auth import auth
from .reportbp import reportsbp
from .modelclient import TEST_DATA_ELEMENTS
from .modelclient import RAW_REPORT_DATA
from .modelclient import RAW_REPORT_DATA_2

import sys
from pathlib import Path

file = Path(__file__).resolve()
package_root_directory = file.parents[1]
Expand Down Expand Up @@ -85,7 +76,7 @@ def unauthorized_handler():

@app.route("/team", methods=['GET'])
def team():
return render_template('team.html', title='Team', data=[])
return render_template('team/team.html', title='Team', data=[])

@app.route("/generate_email", methods=['POST'])
def generate_email():
Expand All @@ -102,7 +93,7 @@ def repo(reponame=None):
client = GithubClient()
repo = client.get_repo_issues("chriswebb09", reponame)
print(repo)
return render_template('team.html', title='Team', data=[])
return render_template('team/team.html', title='Team', data=[])

if __name__ == "__main__":
app.run(debug=True, port=5000)
4 changes: 3 additions & 1 deletion DirectReport/browserview/github.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env python3

import json
import re

import requests
import json

from DirectReport.datadependencies import appsecrets, prompts


Expand Down
1 change: 1 addition & 0 deletions DirectReport/browserview/prompt_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import openai

from DirectReport.datadependencies import appsecrets, prompts

openai.api_key = appsecrets.SECRET_KEY
Expand Down
15 changes: 7 additions & 8 deletions DirectReport/browserview/reportbp.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#!/usr/bin/env python3

import ast
from flask import Flask, render_template, request, json
from flask import Blueprint
from DirectReport.browserview.app import login_required
from flask import render_template, request, json
from flask_login import login_required, current_user
from DirectReport.models.report_builder import ReportBuilder
from DirectReport.models.report_model import ReportModel
from DirectReport.models.entry_storage import EntryStorage
from DirectReport.models.list_builder import ListBuilder

from DirectReport.browserview.github import GithubClient
from DirectReport.browserview.github import GoogleAIClient
from DirectReport.models.entry_storage import EntryStorage
from DirectReport.models.list_builder import ListBuilder
from DirectReport.models.report_builder import ReportBuilder
from DirectReport.models.report_model import ReportModel

reportsbp = Blueprint('reportsbp', __name__)

Expand Down Expand Up @@ -43,7 +42,7 @@ def team_report():
if request.method == "POST":
json_data = request.get_json()
report_model = ReportModel(json_data["id"], json_data['summary'], json_data['created_at'])
return render_template('teamreport.html', title='Team Report', data=[])
return render_template('team/teamreport.html', title='Team Report', data=[])

@reportsbp.route('/entry/<uid>', methods=['GET', 'POST'])
@login_required
Expand Down
3 changes: 3 additions & 0 deletions DirectReport/browserview/static/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dropdown:hover .dropdown-menu {
display: block;
}
93 changes: 30 additions & 63 deletions DirectReport/browserview/static/js/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,34 @@ const { useState, useEffect } = React;

const AccountUserInfo = (userData, reportData) => {
return (
<div className="lg:col-span-1 md: col-span-1 sm:col-span-3 justify-center my-1">
<div className="shadow-lg self-center bg-blue-200 py-10 px-8 my-2 shadow-lg rounded-2xl">
<div className="py-10 mb-10 bg-blue-50 rounded-2xl">
<h1 className="text-left px-10"><span className="font-semibold">Account:</span> {userData.name}</h1>
<h1 className="text-left px-10"><span className="font-semibold">Email:</span> {userData.userid}</h1>
<p className="text-left px-10"><span className="font-semibold">Username:</span> {userData.username}
</p>
<p className="text-left px-10"><span
className="font-semibold">Number of reports saved</span> {reportData.length}</p>
<div className="lg:col-span-3 md:col-span-1 sm:col-span-3 justify-center">
<div className="grid grid-flow-col gap-10 shadow-lg self-center bg-blue-200 py-6 px-5 my-2 shadow-lg rounded-3xl">
<div className="col-span-1 py-6 bg-blue-50 rounded-3xl">
<div className="bg-blue-50 rounded-2xl pl-20">
<h1 className="text-left pl-5">
<span className="pr-4 font-semibold">Account: </span>{userData.name}
</h1>
<h1 className="text-left pl-5 pt-1">
<span className="pr-10 font-semibold">Email: </span> {userData.userid}
</h1>
</div>
</div>
</div>
</div>
)
}

const ReportInfo = () => {
return (
<div className="lg:col-span-1 sm:col-span-3 justify-center my-1">
<div className="shadow-lg self-center bg-blue-200 py-10 px-10 my-2 shadow-lg rounded-2xl">
<div className="py-10 mb-20 bg-blue-50 rounded-2xl">
<a className="py-10 text-md hover:text-gray-200" href="/teamreport">
<button type="button" className="w-full text-white bg-indigo-700 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800">New Report</button>
</a>
<div className="col-span-1 py-6 bg-blue-50 rounded-3xl">
<div className="bg-blue-50 rounded-2xl pl-20">
<p className="text-left pl-4 pt-1">
<span className="pr-11 font-semibold">Username: </span> {userData.username}
</p>
<p className="text-left pl-4 pt-1">
<span className="pr-4 font-semibold">Number of reports saved: </span> {reportData.length}
</p>
</div>
</div>
</div>
</div>
)
}

const ListDiv = () => {
return (
<div className="lg:col-span-1 sm:col-span-3 justify-center my-1">
<div className="shadow-lg self-center bg-blue-200 py-10 px-10 my-2 shadow-lg rounded-2xl">
<a className="py-10 text-md hover:text-gray-200" href="/list">
<button type="button"
className="w-full text-white bg-indigo-700 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800">
List
</button>
</a>
</div>
</div>
)
}


const LogoutDiv = () => {
return (
<div className="col-span-3 justify-center my-1">
<div className="shadow-lg self-center bg-blue-200 py-10 px-8 my-2 shadow-lg rounded-2xl">
<div className="mx-80">
<a className="px-6 text-md hover:text-gray-200" href="/logout">
<button type="button"
className="w-full text-white bg-indigo-700 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800">Log
Out
</button>
</a>
</div>
</div>
</div>
)
}
const Account = () => {

const [userData, setUserData] = useState({});
const [actualData, setActualData] = useState({});
const [reportData, setReportData] = useState([]);
Expand Down Expand Up @@ -97,20 +62,22 @@ const Account = () => {
});
}, []);



if (loading) {
return (
<div>{`There is a problem fetching the post data - ${error}`}</div>
)
} else {

return (
<div className="grid grid-cols-3 gap-8 mb-1 mx-20 justify-cente">
{userData && AccountUserInfo(userData, reportData)}
<ReportInfo />
<ListDiv />
<LogoutDiv />
<div className="mx-50 content-center mt-0 mb-48 h-150">
<div className="pt-5 pb-3 mt-0 mb-5 ml-20 px-20">
<h1 className="text-2xl text-blue-800 text-left font-bold font-mono pt-5">
User Account
</h1>
</div>

<div className="grid grid-cols-3 gap-8 mb-1 mx-20 px-20 justify-center">
{userData && AccountUserInfo(userData, reportData)}
</div>
</div>
)
}
Expand Down
6 changes: 3 additions & 3 deletions DirectReport/browserview/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ class Home extends React.Component {
React.createElement(
"h2",
{
className: "my-1 text-3xl font-bold mb-5 text-white"
className: "mt-1 text-3xl font-bold mb-3 text-white"
},
"DirectReport."
),
React.createElement(
"h3",
{
className: "my-1 text-lg mb-8 text-gray-200"
className: "mt-4 text-lg mb-11 text-gray-200"
},
"Keep track of your accomplishments each day of the workweek."
),
React.createElement(
"div",
{
className: "my-8"
className: "my-15"
},
React.createElement(
"a",
Expand Down
9 changes: 6 additions & 3 deletions DirectReport/browserview/static/js/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ const { useState, useEffect } = React;
class EntryList extends React.Component {
render() {
return (
<div class="grid grid-cols-3 gap-1 mb-20 mx-10">
<div className="grid grid-cols-3 gap-1 mb-20 mx-20">
<h1 className="col-span-3 text-2xl text-blue-800 text-left font-bold font-mono mb-4 mx-10">
Saved Reports
</h1>
{this.props.listdata.map(item =>
<div class="col-span-1 justify-center my-5">
<article className="mx-8 mt-8 w-90 rounded-2xl border border-gray-200 p-1 shadow-lg transition hover:shadow-xl">
<div className="col-span-1 justify-center mt-3 mb-3">
<article className="mx-4 mt-2 w-90 rounded-2xl border border-gray-200 p-1 shadow-lg transition hover:shadow-xl">
<a className="block rounded-xl bg-white p-1 sm:p-6 lg:p-8" href={'/entry/' + item.uuid}>
<div className="mt-1">
<h2 className="text-2xl font-bold text-gray-800 sm:text-xl">{'Topic: ' + item.user_id}</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ const { useState, useEffect } = React;

const TeamData = () => {

const [teamData, setTeamData] = useState({});
const [teamData, setTeamData] = useState({})
const [commentText, setCommentText] = useState("")
const [isOpened, setIsOpened] = useState(false);
const [isOpened, setIsOpened] = useState(false)

const handleSubmit = e => {
e.preventDefault()
var dataForm = {
Expand Down Expand Up @@ -131,18 +132,6 @@ const TeamData = () => {
setIsOpened(isOpened => !isOpened);
}

const ShowSummary = (report) => {
return (
<p id="show_summary" className="w-97 sm:w-97 overflow-y-auto break-words">
{report !== undefined ?
<div className="px-2 mb-1 text-xs text-blue-700">
{report["summary"]}
</div> : null
}
</p>
)
}

return (
<div>
<h1 className="self-center text-center text-2xl text-blue-800 text-center font-bold font-mono pt-3 pb-2 mb-2 pt-4 mx-10 px-20">
Expand All @@ -169,7 +158,7 @@ const TeamData = () => {
<div id="team_member_to_select" className="lg:col-span-1 sm:col-span-3 justify-center">
<div className="pb-6 pt-2 bg-blue-500 rounded-3xl px-4 mb-2 shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.48)]">
<h1 className="self-center text-center text-xl text-white text-center font-semibold font-mono mb-1 mt-2 mx-20 px-20">Team</h1>
<PopoverUI closePopover={closePopover}/>
{PopoverUI(closePopover)}
<div id="display_team" className="my-3"></div>
{isOpened && (
<div className="content-center py-1 h-90 rounded-3xl mb-4 bg-slate-100 shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.28)] mx-1 px-3">
Expand All @@ -180,10 +169,7 @@ const TeamData = () => {
</div>
</div>
{isOpened && (
<div>
<h3 className="text-xl text-blue-800 text-left font-mono font-semibold mt-10 mb-5 mx-5 px-12">Data</h3>
<GraphDiv/>
</div>
<GraphicsUI/>
)}
</div>
);
Expand Down
Loading

0 comments on commit 7d10ffc

Please sign in to comment.