-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from Code-the-Dream-School/78b_build_figma_ent…
…ries_with_postgresql 78b build figma entries with postgresql
- Loading branch information
Showing
26 changed files
with
1,285 additions
and
197 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
module ApplicationHelper | ||
|
||
MOOD_CATEGORIES = { | ||
high_energy_pleasant: ['Cheerful', 'Upbeat', 'Pleased', 'Excited', 'Happy'], | ||
low_energy_pleasant: ['Connected', 'Calm', 'Relaxed', 'Thoughtful', 'Good'], | ||
high_energy_unpleasant: ['Irate', 'Peeved', 'Tense', 'Angry', 'Anxious'], | ||
low_energy_unpleasant: ['Sad', 'Bored', 'Tired', 'Meh', 'Disappointed'] | ||
} | ||
|
||
def mood_group(emotion) | ||
MOOD_CATEGORIES.each do |key, emotions| | ||
return key.to_s.dasherize if emotions.include?(emotion) | ||
end | ||
|
||
"neutral" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
<h1>Dashboard</h1> | ||
|
||
|
||
<div class="header-actions"> | ||
<%= link_to 'Profile', profile_path, class:'new-entry-button'%> | ||
<%= link_to 'Entries', entries_path , class: 'new-entry-button' %> | ||
<%= link_to 'Sign out', destroy_user_session_path, data: { turbo_method: :delete }, class: 'new-entry-button' %> | ||
<%= link_to 'Friends', friend_entries_path, class: 'new-entry-button' %> | ||
|
||
<% if current_user.notification %> | ||
<%= link_to 'Schedule', notification_path(current_user.notification), class:'new-entry-button' %> | ||
<% else %> | ||
<%= link_to 'Schedule', new_notification_path, class:'new-entry-button' %> | ||
<% end %> | ||
|
||
</div> | ||
<section class="dashboard__main-container"> | ||
<p>How are you feeling right now?</p> | ||
<div class="dashboard__spinner"></div> | ||
<div class="dashboard__create-entry-container"> | ||
<div class="dashboard__entry-create"> | ||
<p class="dashboard__plus">﹢</p> | ||
</div> | ||
<p>Check in</p> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,64 @@ | ||
<%= form_with(model: entry, local: true) do |form| %> | ||
<%= form_with(model: @entry, local: true) do |f| %> | ||
<section class="entries__new-content-container"> | ||
<div class="entries__new-info-container"> | ||
<div class="entries__new-emotion-selector-container"> | ||
<p>How are you feeling?</p> | ||
<%= f.select :emotion, %w[Connected Calm Good Thoughtful Relaxed Sad Bored Tired Meh Disappointed Excited Pleased Happy Cheerful Upbeat Angry Anxious Peeved Tense Irate] %> | ||
</div> | ||
|
||
<% if entry.errors.any? %> | ||
<div> | ||
<ul> | ||
<% entry.errors.full_messages.each do |message| %> | ||
<li><%= message %></li> | ||
<div class="entries__new-emotion-selector-container"> | ||
<p>How's your energy?</p> | ||
<%= f.select :energy_level, %w[1 2 3 4 5 6 7 8 9 10] %> | ||
</div> | ||
|
||
<div class="entries__new-private-public-container"> | ||
<p>Public Entry?</p> | ||
|
||
<div class="app__form-partial-public-checkbox"> | ||
<%= f.check_box :is_public %> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="entries__new-tags-container"> | ||
<% tag_options = { | ||
"company" => %w[Friends Family Pets Strangers Myself Colleagues], | ||
"activity" => %w[Cooking Eating Working\ out Cleaning Journaling Meditating Working Dancing Water\ Aerobics], | ||
"location" => %w[Home Library School Work Park Outside Gym Restaurant Club] | ||
} %> | ||
|
||
<h2>Who are you with?</h2> | ||
<div class="entries__new-company-tags-container"> | ||
<% tag_options["company"].each do |option| %> | ||
<%= f.check_box :company, { multiple: true, id: "company_#{option.parameterize}" }, option%> | ||
<%= f.label :company, option, for: "company_#{option.parameterize}", class: 'entries__new-tag-label' %> | ||
<% end %> | ||
</div> | ||
|
||
<h2>What are you doing?</h2> | ||
<div class="entries__new-activity-tags-container"> | ||
<% tag_options["activity"].each do |option| %> | ||
<%= f.check_box :activity, { multiple: true, id: "activity_#{option.parameterize}" }, option %> | ||
<%= f.label :activity, option, for: "activity_#{option.parameterize}", class: 'entries__new-tag-label' %> | ||
<% end %> | ||
</div> | ||
|
||
<h2>Where are you?</h2> | ||
<div class="entries__new-location-tags-container"> | ||
<% tag_options["location"].each do |option| %> | ||
<%= f.check_box :location, { multiple: true, id: "location_#{option.parameterize}" }, option %> | ||
<%= f.label :location, option, for: "location_#{option.parameterize}", class: 'entries__new-tag-label' %> | ||
<% end %> | ||
</ul> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
||
<div> | ||
<%= form.label :text, "Entry Text" %> | ||
<%= form.text_area :text, rows: 5, placeholder: 'Write your entry here...' %> | ||
</div> | ||
|
||
<div> | ||
<%= form.label :emotion %> | ||
<%= form.select :emotion, options_for_select(['Happy', 'Sad', 'Excited', 'Angry', 'Anxious', 'Other'], entry.emotion), { prompt: 'Select Emotion' } %> | ||
</div> | ||
|
||
<div> | ||
<%= form.label :location %> | ||
<%= form.text_field :location, placeholder: 'Where are you?' %> | ||
</div> | ||
|
||
<div> | ||
<%= form.label :people, "People Involved" %> | ||
<%= form.text_field :people, placeholder: 'Who are you with?' %> | ||
</div> | ||
|
||
<div> | ||
<%= form.label :activity %> | ||
<%= form.text_field :activity, placeholder: 'What are you doing?' %> | ||
</div> | ||
|
||
<div> | ||
<%= form.label :energy_level, "Energy Level (1-10)" %> | ||
<%= form.number_field :energy_level, in: 1..10, step: 1, placeholder: 'Rate your energy level' %> | ||
</div> | ||
|
||
<div> | ||
<%= form.label :is_public, "Make this entry public?" %> | ||
<%= form.check_box :is_public %> | ||
</div> | ||
|
||
<div> | ||
<%= form.submit %> | ||
</div> | ||
|
||
<div class="entries__new-text-container"> | ||
<%= f.label :text, "Write some notes about your day" %> | ||
<%= f.text_area :text, rows: 10, placeholder: "Write your entry here...", class: "entries__new-text-field" %> | ||
</div> | ||
|
||
<%= f.submit class: 'entries__new-submit-button' %> | ||
|
||
</section> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<h1>Edit Entry</h1> | ||
<div class="entries__edit-header"> | ||
<p>Edit Entry</p> | ||
</div> | ||
|
||
<%= render 'form', entry: @entry %> | ||
|
||
<%= link_to 'Back', entries_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,88 @@ | ||
<h1>My Entries</h1> | ||
<section class="entries__index-all-entries-container"> | ||
<h2>My Entries</h2> | ||
<div class="header-actions"> | ||
<%= link_to 'New Entry', new_entry_path, class: 'new-entry-button' %> | ||
<%= link_to 'Dashboard', dashboard_index_path, class: 'new-entry-button' %> | ||
</div> | ||
|
||
<div class="header-actions"> | ||
<%= link_to 'New Entry', new_entry_path, class: 'new-entry-button' %> | ||
<%= link_to 'Dashboard', dashboard_index_path, class: 'new-entry-button' %> | ||
</div> | ||
|
||
<div class="entries-container"> | ||
<% @entries.each do |entry| %> | ||
<div class="entry-card"> | ||
<h2 class="entry-title"><%= entry.text %></h2> | ||
<div class="entry-actions"> | ||
<%= link_to 'Show', entry, class: 'action-button show-button' %> | ||
<%= link_to 'Edit', edit_entry_path(entry), class: 'action-button edit-button' %> | ||
<%= button_to 'Delete', entry, method: :delete, class: 'action-button delete-button' %> | ||
<section | ||
class="<%= 'entries__index-' + mood_group(entry.emotion)%> entries__index-entry-container entry-click" | ||
data-url="<%= entry_path(entry) %>"> | ||
<div class="entries__index-entry-header"> | ||
<div class="entries__index-entry-header-left"> | ||
<p><%= entry.created_at.strftime("%a %b %-d %l:%M %p") %></p> | ||
|
||
<div class="entries__index-entry-header-left-tags-container"> | ||
<% all_tags = JSON.parse(entry.company) + JSON.parse(entry.activity) + JSON.parse(entry.location)%> | ||
<% all_tags.each do |tag| %> | ||
<% unless tag == "0" %> | ||
<p><%=tag %></p> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
<div class="entries__index-entry-header-right"> | ||
<div>avatar</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="entries__index-entry-footer"> | ||
<div class="entries__index-entry-footer-left"> | ||
<p><span>I'm feeling </span></p> | ||
<p class="entries__show-emotion-label"><%= entry.emotion %></p> | ||
</div> | ||
|
||
<div class="entries__index-entry-footer-right"> | ||
<div>emotion shape placeholder</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<div class="entries__index-blob"> | ||
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" width="130%" id="blobSvg"> | ||
<defs> | ||
<linearGradient id="fill" x1="0%" y1="0%" x2="100%" y2="0%" gradientTransform="rotate(245 0.5 0.5)"> | ||
<stop offset="0%" stop-color=" | ||
rgba(234, 255, 214, 0.02) | ||
"></stop> | ||
|
||
</linearGradient> | ||
</defs> | ||
<path fill="url(#fill)"> | ||
<animate attributeName="d" dur="10s" repeatCount="indefinite" | ||
values=" | ||
M80.5,60.5Q67,71,56,72Q45,73,36,67Q27,61,26.5,49.5Q26,38,34,26.5Q42,15,57.5,18Q73,21,83.5,35.5Q94,50,80.5,60.5Z; | ||
M81.5,60Q66,70,53.5,80Q41,90,24.5,80Q8,70,12.5,52Q17,34,28.5,20.5Q40,7,52.5,19.5Q65,32,81,41Q97,50,81.5,60Z; | ||
M83.5,64Q72,78,58.5,75Q45,72,31,69Q17,66,16,49.5Q15,33,28.5,25Q42,17,53.5,24.5Q65,32,80,41Q95,50,83.5,64Z; | ||
M74.5,58Q63,66,54,69Q45,72,26,71.5Q7,71,18.5,55.5Q30,40,37.5,33.5Q45,27,63,19Q81,11,83.5,30.5Q86,50,74.5,58Z; | ||
M77,67.5Q78,85,59.5,87.5Q41,90,32,76.5Q23,63,26.5,51.5Q30,40,35,22Q40,4,59,9.5Q78,15,77,32.5Q76,50,77,67.5Z; | ||
M80.5,60.5Q67,71,56,72Q45,73,36,67Q27,61,26.5,49.5Q26,38,34,26.5Q42,15,57.5,18Q73,21,83.5,35.5Q94,50,80.5,60.5Z | ||
"/> | ||
</path> | ||
</svg> | ||
</div> | ||
|
||
</section> | ||
<% end %> | ||
</div> | ||
</section> | ||
|
||
<script> | ||
document.addEventListener('turbo:load', () => { | ||
document.querySelectorAll('.entry-click').forEach((element) => { | ||
element.addEventListener('click', () => { | ||
console.log('click'); | ||
const url = element.getAttribute('data-url'); | ||
if (url) { | ||
window.location = url; | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<h1>New Entry</h1> | ||
<div class="entries__new-header"> | ||
<p>Edit Entry</p> | ||
</div> | ||
|
||
<%= render 'form', entry: @entry %> | ||
|
||
<%= link_to 'Back', entries_path %> |
Oops, something went wrong.