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

Venue Styling/Bug Fixes #88

Merged
merged 69 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
ddb3b1c
review star component & scroll bar component
ihysi2024 Oct 17, 2024
4aa7598
top half venue screen components filled not connected
ihysi2024 Oct 21, 2024
b00d742
troubleshooting render
ihysi2024 Oct 21, 2024
108bbb9
adding migration file for creating event table & populating w dummy data
ihysi2024 Oct 22, 2024
19fe130
migration file for creating new event table & corresponding crud rout…
ihysi2024 Oct 22, 2024
4701b74
Merge branch 'database-change/make-event-table' of https://github.com…
ihysi2024 Oct 22, 2024
d7d50a3
took out some frontend changes - not ready yet
ihysi2024 Oct 22, 2024
49ed12a
Merge branch 'main' into database-change/make-event-table
ihysi2024 Oct 22, 2024
7b71f25
removed front end components
ihysi2024 Oct 22, 2024
63ce3e1
Merge branch 'database-change/make-event-table' of https://github.com…
ihysi2024 Oct 22, 2024
1f5b599
fixed sql query
ihysi2024 Oct 22, 2024
46a3d96
fixed sql query
ihysi2024 Oct 22, 2024
7381ec8
fixed sql query
ihysi2024 Oct 22, 2024
62de0ce
venue screen frontend complete
ihysi2024 Oct 23, 2024
c7e1682
venue screen frontend complete
ihysi2024 Oct 23, 2024
a3d671a
fixing merge conflicts
ihysi2024 Oct 23, 2024
1a16d62
Merge branch 'main' of https://github.com/GenerateNU/nightlife into f…
ihysi2024 Oct 23, 2024
69f6d81
fixing merge conflicts
ihysi2024 Oct 23, 2024
c6001cb
fixing merge conflicts
ihysi2024 Oct 23, 2024
ca2352c
connected title/address to backend
ihysi2024 Nov 4, 2024
2b0bea8
event route group changes
ihysi2024 Nov 10, 2024
6d443dd
event route connected to backend
ihysi2024 Nov 11, 2024
c3256cc
ratings refactor -> aligning figma/database
ihysi2024 Nov 13, 2024
063b187
ratings refactor -> aligning figma/database
ihysi2024 Nov 13, 2024
30edc4a
ratings refactor -> aligning figma/database
ihysi2024 Nov 13, 2024
2b587a5
ratings refactor -> aligning figma/database
ihysi2024 Nov 13, 2024
6fa8872
ratings refactor -> aligning figma/database
ihysi2024 Nov 13, 2024
7b7a44c
ratings refactor -> aligning figma/database
ihysi2024 Nov 13, 2024
065681a
ratings refactor -> aligning figma/database
ihysi2024 Nov 13, 2024
fdd5b29
event & rating table fixes, rating route group
ihysi2024 Nov 15, 2024
fde3fef
event & rating table fixes, rating route group
ihysi2024 Nov 15, 2024
db843c7
skeleton frontend for venue rating screen
ihysi2024 Nov 18, 2024
c3cd4a3
in prog
ihysi2024 Nov 22, 2024
e7f4acd
fix: tab selection functionality
benjaspet Nov 22, 2024
d898291
gradients
ihysi2024 Nov 24, 2024
ecd5d10
venue screen completed
ihysi2024 Dec 3, 2024
c2f9360
venue screen completed
ihysi2024 Dec 3, 2024
853f775
venue screen completed
ihysi2024 Dec 3, 2024
ca4e26f
venue screen completed
ihysi2024 Dec 3, 2024
7672c30
venue screen completed
ihysi2024 Dec 3, 2024
982dc57
venue screen completed
ihysi2024 Dec 3, 2024
d95ff8b
merge conflicts in backend endpoints resolved & images working
ihysi2024 Dec 3, 2024
d27bf85
merge conflicts in backend endpoints resolved & images working
ihysi2024 Dec 3, 2024
59ac1eb
merge conflicts in backend endpoints resolved & images working
ihysi2024 Dec 3, 2024
aa22dbf
merge conflicts in backend endpoints resolved & images working
ihysi2024 Dec 3, 2024
571dcdf
merge conflicts in backend endpoints resolved & images working
ihysi2024 Dec 3, 2024
793be58
merge conflicts in backend endpoints resolved & images working
ihysi2024 Dec 3, 2024
d8237c3
time fix
ihysi2024 Dec 4, 2024
9a24b41
styling fixes
wyattchris Dec 4, 2024
caf512b
final touches, needs font, user persona, and screen nav from explore/map
Dec 4, 2024
4158cae
final touches, needs font, user persona, and screen nav from explore/map
Dec 4, 2024
c39984a
final touches, needs font, user persona, and screen nav from explore/map
Dec 4, 2024
c554257
styling and web viewer bugs fixed, just need user personas, dt font &…
Dec 4, 2024
8744157
nav fix for resonate button
Dec 5, 2024
ef247eb
nav fix for resonate button
Dec 5, 2024
e7c11e7
nav fix for resonate button
Dec 5, 2024
02a0efa
nav fix for resonate button
Dec 5, 2024
cd16001
nav fix for resonate button
Dec 5, 2024
17c5b3b
venue done
Dec 5, 2024
b550767
final venue
Dec 5, 2024
ac4f5de
final venue
Dec 5, 2024
14259d5
final venue
Dec 5, 2024
ae504d0
final venue
Dec 5, 2024
ef90025
final venue
Dec 5, 2024
434a028
last one
Dec 5, 2024
d9a2d73
last one
Dec 5, 2024
7941dcd
last one
Dec 5, 2024
6e2c0e5
last one
Dec 5, 2024
c02bc69
Merge branch 'main' of https://github.com/GenerateNU/nightlife into f…
Dec 5, 2024
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
5 changes: 5 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": [
"expo-font"
]
}
50 changes: 39 additions & 11 deletions backend/internal/handlers/venues/venues.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"strconv"
"strings"

"sort"
"github.com/GenerateNU/nightlife/internal/errs"
"github.com/GenerateNU/nightlife/internal/models"
"github.com/GenerateNU/nightlife/internal/types"
Expand Down Expand Up @@ -196,26 +196,54 @@ func (s *Service) GetVenuePersona(c *fiber.Ctx) error {
fmt.Println("error: " + err.Error())
return fiber.NewError(fiber.StatusInternalServerError, "Could not get venue")
}

// Calculate weights
total := v.AvgEnergy + v.AvgExclusive + v.AvgMainstream + v.AvgPrice
priceWeight := v.AvgPrice / total
mainstreamWeight := v.AvgMainstream / total
energyWeight := v.AvgEnergy / total
exclusiveWeight := v.AvgExclusive / total

temp := models.ByRecommendation{}
persona := ``
minDistance := math.Inf(1)
allDists := []struct {
Persona string
Distance float64
}{}

// Calculate distances and populate allDists
for key, value := range temp.CharacterMap() {
// energy, exclusive, mainstream, price
distance := math.Abs(float64(energyWeight)-float64(value[0])) + math.Abs(float64(exclusiveWeight)-float64(value[1])) + math.Abs(float64(mainstreamWeight)-float64(value[2])) + math.Abs(float64(priceWeight)-float64(value[3]))
if distance < minDistance {
persona = key
minDistance = distance
}
distance := math.Abs(float64(energyWeight)-float64(value[0])) +
math.Abs(float64(exclusiveWeight)-float64(value[1])) +
math.Abs(float64(mainstreamWeight)-float64(value[2])) +
math.Abs(float64(priceWeight)-float64(value[3]))

allDists = append(allDists, struct {
Persona string
Distance float64
}{
Persona: key,
Distance: distance,
})
}
if persona == `` {

// If no personas are available
if len(allDists) == 0 {
return c.Status(fiber.StatusOK).JSON("Not enough reviews to determine venue persona")
}
return c.Status(fiber.StatusOK).JSON(persona)

// Sort allDists by ascending distance
sort.Slice(allDists, func(i, j int) bool {
return allDists[i].Distance < allDists[j].Distance
})

// Collect the top 3 personas (or fewer if less than 3 exist)
top3Personas := []string{}
for i := 0; i < len(allDists) && i < 3; i++ {
top3Personas = append(top3Personas, allDists[i].Persona)
}

// Return the top 3 personas
return c.Status(fiber.StatusOK).JSON(top3Personas)
}

func (s *Service) GetVenuesByIDs(c *fiber.Ctx) error {
Expand Down
9 changes: 5 additions & 4 deletions backend/internal/storage/postgres/userrating.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ WHERE

func (db *DB) CreateReview(ctx context.Context, p models.Review) error {
query := `INSERT INTO review (overall_rating, energy_rating, mainstream_rating, price_rating, crowd_rating, hype_rating,
exclusive_rating, review_text, venue_id, user_id)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`
exclusive_rating, review_text, venue_id, user_id)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`

_, err := db.conn.Query(ctx, query, p.OverallRating, p.EnergyRating,
p.MainstreamRating, p.PriceRating, p.CrowdRating,
p.HypeRating, p.ExclusiveRating, p.ReviewText, p.VenueID, p.UserID)
p.MainstreamRating, p.PriceRating, p.CrowdRating,
p.HypeRating, p.ExclusiveRating, p.ReviewText, p.VenueID, p.UserID)

return err
}
1 change: 0 additions & 1 deletion backend/internal/storage/postgres/venues.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func (db *DB) GetAllVenues(ctx context.Context) ([]models.Venue, error) {
saturday_hours, sunday_hours, ST_Y(location::geometry) AS latitude, ST_X(location::geometry) AS longitude FROM venue`
rows, err := db.conn.Query(ctx, query)
if err != nil {
fmt.Print("hello")
return []models.Venue{}, err
}
defer rows.Close()
Expand Down
16 changes: 10 additions & 6 deletions frontend/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import MusicPreferences from './components/OnboardingCards/MusicPreference';
import PersonalityScreenReveal from './components/OnboardingCards/PersonalityScreenReveal'
import PersonalityScreenReveal2 from './components/OnboardingCards/PersonalityScreenReveal2'
import HowFarFromYou from './components/OnboardingCards/HowFarFromYou';

import { RootSiblingParent } from 'react-native-root-siblings';
import { Archivo_400Regular, Archivo_500Medium, Archivo_700Bold, useFonts } from "@expo-google-fonts/archivo";
import { PlayfairDisplay_400Regular } from '@expo-google-fonts/playfair-display';

const Stack = createNativeStackNavigator();

Expand Down Expand Up @@ -140,15 +141,18 @@ export default function App() {
Archivo_400Regular,
Archivo_500Medium,
Archivo_700Bold,
PlayfairDisplay_400Regular
});

return (
fontsLoaded && (
<AuthProvider>
<NavigationContainer>
<MainNavigator />
</NavigationContainer>
</AuthProvider>
<RootSiblingParent>
<AuthProvider>
<NavigationContainer>
<MainNavigator />
</NavigationContainer>
</AuthProvider>
</RootSiblingParent>
)
);
}
Expand Down
14 changes: 14 additions & 0 deletions frontend/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"plugins": [
[
"expo-image-picker",
{
"photosPermission": "The app accesses your photos to let you share them with your friends."
}
],
[
"expo-font",
{
"fonts": ["./assets/fonts/DTNightingale-Light.ttf"]
}
]
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.generate.nightlife"
Expand Down
Binary file added frontend/assets/blitz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/buckley.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/lumi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/mid_size_star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/plumehart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/roux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/serafina.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/small_filled_star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/sprig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 13 additions & 20 deletions frontend/components/Venue/BookmarkButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { View, TouchableOpacity, Image, StyleSheet } from "react-native";
import PropTypes from "prop-types";
import Toast from "react-native-toast-message";
import Toast from 'react-native-root-toast'

const BookmarkButton = ({ venueID = "", userID = "" }) => {
const bookmarkVenue = async () => {
Expand All @@ -25,41 +25,34 @@ const BookmarkButton = ({ venueID = "", userID = "" }) => {
if (response.ok) {
const data = await response.json();
console.log("Bookmark submitted successfully:", data);

Toast.show({
type: "success",
text1: "Bookmark Saved!",
text2: "The venue has been successfully bookmarked.",
visibilityTime: 2000,
Toast.show("Venue Bookmarked!", {
duration: 800,
position: Toast.positions.BOTTOM,
backgroundColor: "#ffffff",
textColor: "#000000",
shadow: true,
animation: true,
hideOnPress: true,
});


} else {
const errorData = await response.json();
console.error("Error submitting review:", errorData);

Toast.show({
type: "error",
text1: "Error Saving Bookmark",
text2: "Unable to save the venue. Please try again.",
visibilityTime: 2000,
});
}
} catch (error) {
console.error("Error:", error);

Toast.show({
type: "error",
text1: "Network Error",
text2: "An error occurred. Please check your connection.",
visibilityTime: 2000,
});
}
};

return (
<View>
<TouchableOpacity onPress={bookmarkVenue}>
<Image
//source={require("../assets/bookmark_button.png")}
// eslint-disable-next-line
source={require("../../assets/bookmark_button.png")}
style={styles.buttonImage}
/>
</TouchableOpacity>
Expand Down
6 changes: 3 additions & 3 deletions frontend/components/Venue/Event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';

const Event = ({ event = { create_at: "", event_date: "", event_id: 0, event_time: "", image_path: "", name: "", venue_id: "" } }) => {
const date = parseISO(event.event_date);
const displayDate = format(date, "MMMM do, yyyy");
const displayDate = format(date, "MMMM do");
const displayTime = format(date, 'h:mm a');

return (
Expand All @@ -17,8 +17,7 @@ const Event = ({ event = { create_at: "", event_date: "", event_id: 0, event_tim
/>
<View style={styles.overlay}>
<Text style={styles.eventText}>{event.name}</Text>
<Text style={styles.dateText}>{displayDate}</Text>
<Text style={styles.timeText}>{displayTime}</Text>
<Text style={styles.dateText}>{displayDate} + {displayTime}</Text>
</View>
</View>
</View>
Expand Down Expand Up @@ -63,6 +62,7 @@ const styles = StyleSheet.create({
dateText: {
color: 'white',
fontSize: 8,
paddingTop: 3
},
timeText: {
color: 'white',
Expand Down
69 changes: 69 additions & 0 deletions frontend/components/Venue/PersonaIcons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from 'react';
import { Image, View, Text, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';

const PersonaIcons = ({ personas = [] }) => {
const PersonaIconImages = {
// eslint-disable-next-line
roux: require('../../assets/roux.png'),
// eslint-disable-next-line
lumi: require('../../assets/lumi.png'),
// eslint-disable-next-line
sprig: require('../../assets/sprig.png'),
// eslint-disable-next-line
serafina: require('../../assets/serafina.png'),
// eslint-disable-next-line
buckley: require('../../assets/buckley.png'),
// eslint-disable-next-line
blitz: require('../../assets/blitz.png'),
// eslint-disable-next-line
plumehart: require('../../assets/plumehart.png'),
};

console.log("*************", personas);
return (
<View style={styles.container}>
{personas.length > 0 ? (
<View style={styles.iconContainer}>
{personas.map((persona, index) => (
<Image
key={index}
source={PersonaIconImages[persona]}
style={styles.icon}
resizeMode="contain"
/>
))}
</View>
) : (
<Text style={styles.message}>Not enough reviews</Text>
)}
</View>
);
};

PersonaIcons.propTypes = {
personas: PropTypes.arrayOf(PropTypes.oneOf(['roux', 'lumi', 'sprig', 'serafina', 'buckley', 'blitz', 'plumehart'])).isRequired
};

const styles = StyleSheet.create({
container: {
padding: 10,
},
iconContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'center',
},
icon: {
width: 50,
height: 50,
marginLeft: 10
},
message: {
textAlign: 'center',
fontSize: 16,
color: '#666'
},
});

export default PersonaIcons;
13 changes: 8 additions & 5 deletions frontend/components/Venue/RatingScrollBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Slider from "@react-native-community/slider";
import {Text, View, StyleSheet} from "react-native";
import PropTypes from 'prop-types';
import SoundWave from "./SoundWave";
import SoundWave from "@/components/Venue/SoundWave";

/**
* Allows a user to submit a rating from 0 - 10 on a specific category
Expand All @@ -17,26 +17,28 @@ import SoundWave from "./SoundWave";
*/
const RatingScrollBar = ({minTitle = "", maxTitle = "", value, onSliderChange, category, startColor, stopColor, avgValue}) => {

const adjustedRating = avgValue === 0 ? 1 : avgValue;

return(
<View style={styles.container}>
<View style={{paddingBottom: 20}}>
<View style={{position: 'absolute', opacity: 0.5}}>
<SoundWave
category={category}
rating={avgValue}
rating={adjustedRating}
startColor={startColor}
stopColor={stopColor}
/>
</View>
<Slider
style={{ marginLeft: 5, width: 350, height: 40}}
style={{ marginLeft: 5, width: 355, marginTop: 2}}
minimumValue={0}
maximumValue={10}
step={1}
value={value}
thumbTintColor="transparent"
// eslint-disable-next-line
thumbImage={require('../../assets/large_filled_star.png')}
thumbImage={require('../../assets/mid_size_star.png')}
minimumTrackTintColor="white"
maximumTrackTintColor="gray"
onValueChange={onSliderChange}/>
Expand All @@ -62,7 +64,8 @@ RatingScrollBar.propTypes = {

const styles = StyleSheet.create({
container: {
alignItems: 'center'
alignItems: 'center',
backgroundColor: '#060019',
},
title: {
fontSize: 18,
Expand Down
Loading
Loading