diff --git a/handlers/events.go b/handlers/events.go index 6a9ef398..db034304 100644 --- a/handlers/events.go +++ b/handlers/events.go @@ -32,6 +32,10 @@ func CreateEvent(c *gin.Context) { func GetEvent(c *gin.Context) { var events []models.GetEvent + c.Writer.Header().Set("Access-Control-Allow-Origin", "*") + c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") + c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With") + c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT") seeRow := c.Param("eventID") eventrow, err := dbmap.Query( @@ -52,6 +56,18 @@ func GetEvent(c *gin.Context) { c.JSON(201, events) //success } +func HandleCors(c *gin.Context) { + c.Writer.Header().Set("Access-Control-Allow-Origin", "*") + c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") + c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With") + c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT") + + + c.AbortWithStatus(204) + return + +} + // creates a new event func UpdateEvent(c *gin.Context) { var updateEvent models.UpdateEvent @@ -130,6 +146,7 @@ func UpdateEvent(c *gin.Context) { } c.JSON(200, updateEvent) //success } + func CreateRSVP(c *gin.Context) { var rsvp models.CreateRSVP @@ -205,3 +222,4 @@ func DeleteEvent(c *gin.Context) { } c.JSON(204, nil) //success } + diff --git a/main.go b/main.go index aa4119a9..743d580d 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,7 @@ func main() { api.POST("/events", handlers.CreateEvent) api.GET("/event/:eventID", handlers.GetEvent) + api.OPTIONS("/event/:eventID", handlers.HandleCors) // This endpoint will update info for an event diff --git a/views/js/evently/src/AboutUs.css b/views/js/evently/src/AboutUs.css new file mode 100644 index 00000000..b860e53b --- /dev/null +++ b/views/js/evently/src/AboutUs.css @@ -0,0 +1,6 @@ +.AboutUs { + background-color: white; + text-align: center; + height: 100%; + width: 100%; +} \ No newline at end of file diff --git a/views/js/evently/src/AboutUs.jsx b/views/js/evently/src/AboutUs.jsx new file mode 100644 index 00000000..cf1b5a35 --- /dev/null +++ b/views/js/evently/src/AboutUs.jsx @@ -0,0 +1,31 @@ +import React from 'react' +import './AboutUs.css' + +function AboutUs() { + return ( +
+

The team:

+
+ +
+

Special thanks to:

+
+ +
+

and everyone at Bitly who guided us on his project!

+
+ ) +}; + +export default AboutUs; \ No newline at end of file diff --git a/views/js/evently/src/App.css b/views/js/evently/src/App.css index 75ffb084..2e82e466 100644 --- a/views/js/evently/src/App.css +++ b/views/js/evently/src/App.css @@ -2,32 +2,6 @@ text-align: center; } -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - ul{ list-style-type: none; margin: 0; diff --git a/views/js/evently/src/App.js b/views/js/evently/src/App.js index 9c8b8082..aab154a8 100644 --- a/views/js/evently/src/App.js +++ b/views/js/evently/src/App.js @@ -6,10 +6,10 @@ import { } from "react-router-dom"; import HomePage from './HomePage.jsx'; import CreateEvent from './CreateEvent.jsx'; -// import RSVP from './RSVP.jsx'; -//import ViewEvent from './ViewEvent.jsx'; -//Add About Us page -//Add a community page +import CommunityPage from './CommunityPage.jsx'; +import AboutUs from './AboutUs.jsx'; +import Header from './header.js'; +import ViewEvent from './ViewEvent.jsx'; function App() { return ( @@ -23,22 +23,20 @@ function App() { Create
  • -

    RSVP

    - {/* RSVP */} + Community
  • -

    Community

    - {/* Community */} -
  • -
  • -

    About Us

    - {/* About Us */} + About Us
  • +
    + } /> + } /> } /> } /> + } /> ); diff --git a/views/js/evently/src/CommunityPage.css b/views/js/evently/src/CommunityPage.css new file mode 100644 index 00000000..08c2c1d4 --- /dev/null +++ b/views/js/evently/src/CommunityPage.css @@ -0,0 +1,6 @@ +.Community { + background-color: white; + text-align: center; + height: 100%; + width: 100%; +} \ No newline at end of file diff --git a/views/js/evently/src/CommunityPage.jsx b/views/js/evently/src/CommunityPage.jsx new file mode 100644 index 00000000..2c023b79 --- /dev/null +++ b/views/js/evently/src/CommunityPage.jsx @@ -0,0 +1,12 @@ +import React from 'react' +import './CommunityPage.css' + +function CommunityPage() { + return ( +
    +

    Work in progress!

    +
    + ) +}; + +export default CommunityPage; \ No newline at end of file diff --git a/views/js/evently/src/CreateEvent.css b/views/js/evently/src/CreateEvent.css index 1fdaf76e..500d8a8b 100644 --- a/views/js/evently/src/CreateEvent.css +++ b/views/js/evently/src/CreateEvent.css @@ -19,6 +19,10 @@ fieldset { padding-bottom: 30px; } +.wrapper{ + background-color: white; +} + .container { background-color: white; font-size: 30px; @@ -27,6 +31,7 @@ fieldset { } .form-container { + background-color: white; padding-left: 50px; padding-top: 20px; padding-right:450px; diff --git a/views/js/evently/src/CreateEvent.jsx b/views/js/evently/src/CreateEvent.jsx index 287347ba..269ac95c 100644 --- a/views/js/evently/src/CreateEvent.jsx +++ b/views/js/evently/src/CreateEvent.jsx @@ -1,6 +1,5 @@ import React, {useState} from 'react'; import './CreateEvent.css'; -import Header from './header.js'; function CreateEvent() { const [file, setFile] = useState(); @@ -37,7 +36,6 @@ console.log(res) console.log("EventTitle", EventTitle) return(
    -

    Enter the details of your event:

    @@ -86,6 +84,7 @@ console.log("EventTitle", EventTitle)

    Public/Private

    @@ -103,7 +102,7 @@ console.log("EventTitle", EventTitle)

    Contact info

    setContactForm(e.target.value)}/>




    - +
    @@ -117,13 +116,6 @@ console.log("EventTitle", EventTitle)



    -
    - {/* Button to publish draft */} - - - {/* Button to save draft (if have time) */} - -
    diff --git a/views/js/evently/src/HomePage.css b/views/js/evently/src/HomePage.css index 1c9719ea..860f44f8 100644 --- a/views/js/evently/src/HomePage.css +++ b/views/js/evently/src/HomePage.css @@ -1,21 +1,15 @@ html { background-color: #EE6123; -} - -#MainText { - /* background of page */ - background-color: #EE6123; - margin: 0; width: auto; height: auto; overflow: auto; +} - /* page text */ +#MainText { + background-color: #EE6123; font-size: 30px; font-family: 'Inter'; text-align: center; - - padding-top: 125px; } .buttons{ @@ -34,27 +28,6 @@ html { border-radius: 8px; } -#HomeLogo{ - background-color: white; - border-radius: 50%; - padding: 7px; - - height: 100px; - width: 100px; - - top: 150px; - left: 10px; - position: absolute; - overflow: hidden; -} - -.Title{ - position: absolute; - top: 135px; - left: 150px; - color: rgb(255, 255, 255, 0.8); -} - .Text{ font-size: 80px; color: white; diff --git a/views/js/evently/src/HomePage.jsx b/views/js/evently/src/HomePage.jsx index 6d40d157..dd38a943 100644 --- a/views/js/evently/src/HomePage.jsx +++ b/views/js/evently/src/HomePage.jsx @@ -1,25 +1,21 @@ import React from "react"; import { - Routes, - Route, Link } from "react-router-dom"; import './App.css' import './HomePage.css' -import CreateEvent from './CreateEvent.jsx'; -import logo from './bitly-logo.png'; +import CreateEvent from './CreateEvent.jsx' +import CommunityPage from './CommunityPage.jsx' const HomePage: React.FC = () => { return ( -
    - +
    -

    Event.ly

    -

    Host your events here!

    +

    Host your events here!

    Get Started -

    Find an event!

    - +

    Find an event!

    + Browse
    ); diff --git a/views/js/evently/src/ViewEvent.css b/views/js/evently/src/ViewEvent.css new file mode 100644 index 00000000..fd0c8454 --- /dev/null +++ b/views/js/evently/src/ViewEvent.css @@ -0,0 +1,39 @@ +.image { + height: 600px; + width: 600px; + float: right; + padding-right: 100px; + padding-top: 100px; +} + +.rsvp-button { + padding: 30px 40px 30px 40px; + color: white; + background: rgba(46, 0, 150); +} + +.title { + text-align:center; + padding: 30px 150px 30px 150px; + display:flexbox; + background: aliceblue; +} + +.container { + display:flex; + max-width: 800px; + background: rgba(238, 97, 35); +} + +.image-container { + position:absolute; + left:60%; +} + +.info-container { + position:absolute; + left:15%; + max-width: 40%; + word-wrap:break-word; +} + diff --git a/views/js/evently/src/ViewEvent.jsx b/views/js/evently/src/ViewEvent.jsx new file mode 100644 index 00000000..bb0e94e4 --- /dev/null +++ b/views/js/evently/src/ViewEvent.jsx @@ -0,0 +1,64 @@ +import React, {useState, useEffect} from 'react'; +import './ViewEvent.css'; +import Header from './header.js'; +import placeholder from './placeholder-cat.jpg' +import {useParams} from "react-router-dom"; + + +function ViewEvent() { + let { event_id } = useParams(); + const [result, setResult] = useState(0) + const fetchParty = async ()=>{ + try { + var res = await fetch("http://localhost:3000/api/event/" + event_id, + { + method: "GET", + mode: "cors", + }) + + var party = await res.json() + setResult(party[0]) + + } catch (err){ + console.log(err) + } + + } + useEffect(() => { + fetchParty() + }, []); + + return( +
    +
    +
    +
    +

    You are invited!

    +
    +

    {result.event_title}

    +
    +

    at {result.time} on {result.date}

    +


    +

    {result.description}

    +

    Max attendees: {result.max_attendees}

    +

    This is a {result.public_private} party.

    +

    +

    Hosted by: {result.host_name}

    +

    {result.contact_info}

    +
    +

    +
    +
    + +

    + +
    +
    +
    + + ) +} + +export default ViewEvent; \ No newline at end of file diff --git a/views/js/evently/src/header.css b/views/js/evently/src/header.css index 9fb3f5d9..06df519c 100644 --- a/views/js/evently/src/header.css +++ b/views/js/evently/src/header.css @@ -1,22 +1,23 @@ .Header { - width: 100%; - display: inline-block; - background-color: rgba(238, 97, 35); - color: rgba(255, 255, 255, 0.8); - text-align: center; - font-size: 30px; - } + width: 100%; + display: inline-block; + background-color: rgba(238, 97, 35); + color: rgba(255, 255, 255, 0.8); + text-indent: 150px; + font-size: 30px; + font-family: 'Inter'; +} #createLogo { - background-color: white; - border-radius: 50%; - padding: 7px; +background-color: white; +border-radius: 50%; +padding: 7px; - height: 100px; - width: 100px; +height: 100px; +width: 100px; - top: 135px; - left: 675px; - position: absolute; - overflow: hidden; +top: 100px; +left: 10px; +position: absolute; +overflow: hidden; } \ No newline at end of file diff --git a/views/js/evently/src/placeholder-cat.jpg b/views/js/evently/src/placeholder-cat.jpg new file mode 100644 index 00000000..d01e0dba Binary files /dev/null and b/views/js/evently/src/placeholder-cat.jpg differ