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

Feature/basic chat #5

Merged
merged 56 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
06ae3e1
Remove existing chat code
jahseng-lee Oct 29, 2023
5a9776e
Add placeholder chat and add new channel page
jahseng-lee Oct 29, 2023
ec8a733
Show a basic layout for a channel when clicked
jahseng-lee Nov 3, 2023
cd03474
Code to set up and invite users to default chat channels
jahseng-lee Nov 3, 2023
7f54806
Placeholder message form for Channel
jahseng-lee Nov 3, 2023
12e2c3a
User can send a message
jahseng-lee Nov 4, 2023
164b08d
Create a new message for the form on send
jahseng-lee Nov 4, 2023
0b538d7
Finally get independent message scroll
jahseng-lee Nov 5, 2023
191188d
Auto-expand message text area on newlines
jahseng-lee Nov 5, 2023
070de87
Ensure newlines are shown in the message
jahseng-lee Nov 5, 2023
bf020f9
Show "Message actions" dots on hover
jahseng-lee Nov 5, 2023
af0b679
Add ability to delete message
jahseng-lee Nov 5, 2023
3071065
Italics on delete messages
jahseng-lee Nov 5, 2023
1cc81fb
Ensure message is part of channel when deleted
jahseng-lee Nov 5, 2023
0410848
Can reply to messages
jahseng-lee Nov 5, 2023
b81a5fb
Show error if can't scroll to reply
jahseng-lee Nov 5, 2023
9c0f034
Ensure navbar is active on correct links
jahseng-lee Nov 5, 2023
97ce089
Ensure reply_to is optional
jahseng-lee Nov 5, 2023
dede3f8
Implement leaving a channel
jahseng-lee Nov 5, 2023
2c1aabc
Remove turbo: false where appropriate
jahseng-lee Nov 5, 2023
f3b91e1
Ensure display name for content-robot account in seeds
jahseng-lee Nov 5, 2023
2cee8d1
Implementing joining a channel
jahseng-lee Nov 6, 2023
c95d8ae
Add filter to joinable channels
jahseng-lee Nov 9, 2023
a74ac70
Implement a "back" button for joinable channels
jahseng-lee Nov 9, 2023
f5ec97c
Set ChannelMember#last_active on Channel#show
jahseng-lee Nov 10, 2023
a56ad12
Update ChannelMember#last_active every 10 seconds
jahseng-lee Nov 10, 2023
96d0b72
First pass unread_message_count
jahseng-lee Nov 10, 2023
a3d3048
Reload chat link to show notifications
jahseng-lee Nov 11, 2023
dae157e
Order channels by #last_action_at
jahseng-lee Nov 11, 2023
38614b5
Notify everyone navbar when someone sends a message in channel
jahseng-lee Nov 12, 2023
9dcd567
Don't update current_user's navbar on message send
jahseng-lee Nov 12, 2023
07e0a23
On "reply" button click, focus text area
jahseng-lee Nov 12, 2023
3c169ca
Add last message to channel list links
jahseng-lee Nov 12, 2023
f43468d
Update channel list on new message sent
jahseng-lee Nov 12, 2023
dc7fb20
Ensure last_action_at is set for Channels
jahseng-lee Nov 12, 2023
6058c6e
Fix Chats navbar link for non-users
jahseng-lee Nov 12, 2023
946b695
Ensure admins can delete messages
jahseng-lee Nov 12, 2023
d956c07
Lazily load channel list
jahseng-lee Nov 12, 2023
5516b0b
Fix joinable channel list; empty list edge case
jahseng-lee Nov 12, 2023
10cd14e
Make reply_to stuff a bit nicer
jahseng-lee Nov 12, 2023
b8d358b
Less margin on Home#index controller
jahseng-lee Nov 12, 2023
f410020
Set max-width on message bubble
jahseng-lee Nov 12, 2023
488481e
Revert "Lazily load channel list"
jahseng-lee Nov 12, 2023
ce82e48
Prepend new sent messages in a channel
jahseng-lee Nov 16, 2023
2f08130
Update message on channel for members if user deletes it
jahseng-lee Nov 16, 2023
76f6e11
Update channel_list on ChannelMember#last_active request
jahseng-lee Nov 16, 2023
9eb788b
Add placeholder profile picture to Profile#show
jahseng-lee Nov 22, 2023
3c767ae
Implement ProfilePicturesController#create and #update
jahseng-lee Nov 22, 2023
b99b255
Add name and profile picture to messages
jahseng-lee Nov 22, 2023
624d2a5
Set appropriate size for derivative
jahseng-lee Nov 22, 2023
0c52621
Add "Load more" link to conversations
jahseng-lee Nov 24, 2023
71cfffb
Use placeholder profile picture in chat
jahseng-lee Nov 24, 2023
fc00a6d
Remove console logs
jahseng-lee Nov 24, 2023
f5a7000
Show "Disconnected" modal if user is offline
jahseng-lee Nov 24, 2023
5584c34
Remove StreamChatClient
jahseng-lee Nov 24, 2023
aacc45a
Ensure 404 when trying to delete a message you don't own
jahseng-lee Nov 24, 2023
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
Binary file modified .yarn/install-state.gz
Binary file not shown.
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ gem "postmark-rails"
# Subscription management
gem "stripe"

# Chat
gem "stream-chat-ruby"

# Markdown support
gem "redcarpet"

Expand Down
15 changes: 0 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ GEM
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
content_disposition (1.0.0)
crass (1.0.6)
cssbundling-rails (1.3.3)
Expand Down Expand Up @@ -119,9 +118,6 @@ GEM
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (3.0.2)
faraday-net_http_persistent (2.1.0)
faraday (~> 2.5)
net-http-persistent (~> 4.0)
ffi (1.16.1)
globalid (1.2.1)
activesupport (>= 6.1)
Expand Down Expand Up @@ -193,8 +189,6 @@ GEM
msgpack (1.7.2)
multi_json (1.15.0)
multipart-post (2.3.0)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.3.7)
date
net-protocol
Expand Down Expand Up @@ -316,7 +310,6 @@ GEM
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
sorbet-runtime (0.5.11074)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand All @@ -326,13 +319,6 @@ GEM
sprockets (>= 3.0.0)
stimulus-rails (1.2.2)
railties (>= 6.0.0)
stream-chat-ruby (3.0.0)
faraday
faraday-multipart
faraday-net_http_persistent
jwt
net-http-persistent
sorbet-runtime
stringio (3.0.8)
stripe (9.4.0)
thor (1.2.2)
Expand Down Expand Up @@ -391,7 +377,6 @@ DEPENDENCIES
shrine-google_cloud_storage
sprockets-rails
stimulus-rails
stream-chat-ruby
stripe
turbo-rails
tzinfo-data
Expand Down
36 changes: 36 additions & 0 deletions app/assets/stylesheets/application.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,48 @@ $primary: #262626;
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';

@import 'channels';
@import 'chats';
@import 'home';
@import 'location';
@import 'profiles';
@import 'search_location';
@import 'visas';

.navbar-actions {
display: flex;
}

.profile-picture {
border-radius: 50%;

height: 180px;
width: 180px;

&.chat-profile-picture {
margin-right: 4px;

height: 36px;
width: 36px;

&.placeholder {
font-size: 1rem;
}
}

&.placeholder {
display: flex;
align-items: center;
justify-content: center;

background-color: lighten($primary, 20%);
color: $white;

font-size: 5rem;

&:hover {
cursor: default;
}
}
}

137 changes: 137 additions & 0 deletions app/assets/stylesheets/channels.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
.chat-channel-section {
flex: 1;

display: flex;
flex-direction: column;

.channel-header {
flex: 0;

display: flex;
flex-direction: row;

border-bottom: 1px solid $primary;

.leave-channel-button {
color: $danger;
}
}

.channel-message-section {
flex: 1 0 0;
overflow: scroll;

display: flex;
flex-direction: column-reverse;

.chat-message {
display: flex;
flex-direction: row;

align-items: center;

margin: 0 0.25rem 0.25rem 0.25rem;

.message-actions-container {
display: none;
flex-direction: row;
align-items: center;

a, button {
display: flex;
}

.delete-icon {
color: $danger;
}
}

&:hover {
.message-actions-container {
display: flex;
}
}

p {
max-width: 50vw;
margin: 0; // reset margin
padding: 0.5rem 0.75rem;
border-radius: 1.5rem;

color: $white;
background-color: $primary;
}

&.chat-message-current-user {
display: flex;
flex-direction: row-reverse;
}

.message-body {
white-space: pre-line;
}

.replying-to-link {
border-bottom: 1px solid $white;
}

.replying-to {
color: $white;
font-size: 0.75rem;
}
}

.load-more-link-container, .start-of-conversation {
display: flex;
justify-content: center;
align-items: center;

margin-top: 0.25rem;
}
}

.channel-message-form-section {
flex: 0;
border-top: 1px solid $primary;

.channel-message-form {
display: flex;
flex-direction: row;

.channel-message-textarea {
flex: 1;
}

.channel-message-button-container {
min-width: 6rem;
flex: 0;
}
}

.reply-to-section {
display: none;
flex-direction: row;

p {
flex: 1;
}
}

.error-scroll-to-reply {
display: none;
color: $danger;
}

.join-channel-section {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}

.message-sender {
font-size: 0.75rem;
margin-left: 44px; // align with message
}
}
78 changes: 49 additions & 29 deletions app/assets/stylesheets/chats.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,63 @@
@import 'stream-chat-react/dist/scss/v2/index.scss';

body {
height: 100vh;
}
max-height: 100vh;

.chat-root {
display: flex;
flex-direction: column;

.str-chat__channel {
flex: 1;
.navbar {
flex: 0;
}

.str-chat-channel-list {
width: 20vw;
}
}
.chat-screen-container {
flex: 1;

.str-chat {
--str-chat__primary-color: #262626;
--str-chat__own-message-bubble-background-color: #262626;
--str-chat__own-message-bubble-color: white;
}
.chat-message-section {
display: flex;
flex-direction: column;

.str-chat__message--me {
--str-chat__message-mention-color: white;
}
border-left: 1px solid $primary;

.str-chat__message-input {
position: abolute;
bottom: 0.5rem;
}
&.no-chat {
justify-content: center;
align-items: center;
}
}

.str-chat__list {
min-height: 75vh;
max-height: 75vh;
overflow: scroll;
}
.channel-list-container {
display: flex;
flex-direction: column;

.channel-list {
flex: 1;

display: flex;
flex-direction: column;

.channel-links-container {
flex: 1 0 0;
overflow: scroll;

display: flex;
flex-direction: column;

.str-chat__thread {
max-width: 30vw;
.channel-link {
border-bottom: 1px solid $primary;
text-decoration: none;

&:hover {
background-color: lighten($primary, 70%);
}
}
}

.channel-list-actions {
flex: 0;

display: grid;
}
}
}
}
}

Empty file.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/visas.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.delete-country-button {
.delete-button {
background: none;
color: inherit;
border: none;
Expand Down
Loading
Loading