Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
249c2ff
setup app and add readme
Slashek Dec 19, 2024
cea5e28
remove community module dependence
Slashek Dec 31, 2024
bd955f2
Working chat with updated ActionCable
z-x Dec 31, 2024
400c1ef
Node deps cleanup
z-x Dec 31, 2024
178df74
Working import maps
z-x Jan 2, 2025
3d36d5d
Fixed missing var, chat works now
z-x Jan 7, 2025
05f30bb
Clean up node modules
z-x Jan 7, 2025
4f308c8
Initial styling
z-x Jan 7, 2025
7a0bb34
Header styling
z-x Jan 7, 2025
41fc00d
Styling further
z-x Jan 7, 2025
aa58a4b
Inbox styling
z-x Jan 8, 2025
270db5e
Basic conversation styling
z-x Jan 9, 2025
8537f59
Textarea styling
z-x Jan 9, 2025
8b5ad47
Updated layout not to overflow viewport height
z-x Jan 9, 2025
42c14b8
Intro page styling
z-x Jan 9, 2025
2421f46
Use HTML template from BE instead of HTML hardcoded in JS files
z-x Jan 13, 2025
834c67a
Fixed loading previous messages page
z-x Jan 13, 2025
56f2b65
Forms styling
z-x Jan 14, 2025
ed24d2d
add playwright
Jan 14, 2025
69fffa8
delete playwright.yml
Jan 14, 2025
4f965c2
Cleanup
z-x Jan 14, 2025
fec9812
make seed.sh executable
Jan 14, 2025
0ccaf20
fix MPKIT_TOKEN
Jan 14, 2025
2ed7e17
fix data path in seed.sh
Jan 14, 2025
62a78d5
fix path
Jan 14, 2025
6e53037
add seed
Jan 14, 2025
b92e5b5
add new users
Jan 14, 2025
2399156
Mobile view
z-x Jan 15, 2025
015a56f
Hide back arrow on desktop
z-x Jan 15, 2025
0cd7fb6
add messaging test
Jan 17, 2025
d8ff835
Merge branch 'run-tests' into setup-app-to-deploy-independently
Jan 17, 2025
e711297
Merge branch 'main' into setup-app-to-deploy-independently
z-x Jan 20, 2025
43a231c
Renamed the styles module
z-x Jan 20, 2025
d285f8c
Merge branch 'setup-app-to-deploy-independently' of https://github.co…
z-x Jan 20, 2025
b321443
Use default pOS brand colors in config and overwrite them in app
z-x Jan 20, 2025
f6ff495
Updated Readme
z-x Jan 21, 2025
33da82c
Updated reset to be scroped only to .pos-app
z-x Jan 21, 2025
8b58d03
Updated modules deps
z-x Jan 21, 2025
760f691
Updated readme
z-x Jan 21, 2025
5e6ee6e
Disable debug mode
z-x Jan 21, 2025
fe8c922
use current profile helper
Slashek Jan 22, 2025
0ff7b21
Merge branch 'setup-app-to-deploy-independently' into use-current-pro…
z-x Jan 22, 2025
b4b4bc0
Merge pull request #7 from Platform-OS/use-current-profile-helper
z-x Jan 22, 2025
4319a22
Sth
z-x Jan 23, 2025
136d3f5
Solve conflicts
z-x Jan 23, 2025
eee32c5
Use new current profile helper
z-x Jan 23, 2025
dc06391
Removed components deps
z-x Jan 23, 2025
7560a06
make the find by uuid more reliable
Slashek Jan 23, 2025
e5a7bae
Merge pull request #8 from Platform-OS/make-the-find-by-uuid-more-rel…
z-x Jan 27, 2025
ffdc204
New namespacing
z-x Jan 27, 2025
bb021fc
Moved profile data from HTML input to JS vars
z-x Jan 28, 2025
6d51cb3
Idk
z-x Jan 30, 2025
bf96f68
Updated
z-x Feb 2, 2025
9329a0b
Updated common-styling
z-x Feb 2, 2025
f4661ce
Updated common-styling
z-x Feb 3, 2025
56075db
Fix timezone JS var
z-x Feb 4, 2025
110fe84
Fixed width for conversations
z-x Feb 11, 2025
e271ac3
Cleanup
z-x Feb 11, 2025
d05228a
Updated readme
z-x Feb 11, 2025
141c311
Updated the components module and overwritten the button
z-x Feb 11, 2025
d0b9183
Bump version
z-x Feb 11, 2025
6f50844
Fixed <small> not being resseted
z-x Feb 11, 2025
73187cb
Updated common-styling
z-x Feb 11, 2025
c6512f3
Bump common-styling deps
z-x Feb 11, 2025
fb55bdf
Update chat message input radius
z-x Feb 12, 2025
4e60f30
Bump version
z-x Feb 12, 2025
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
Prev Previous commit
Next Next commit
New namespacing
  • Loading branch information
z-x committed Jan 27, 2025
commit ffdc204015f1bba7667787f58a922af6b8c9db86
12 changes: 6 additions & 6 deletions modules/chat/public/assets/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// ------------------------------------------------------------------------
import consumer from 'consumer.js';



// purpose: handles sending and receiving messages as well as the inbox page
// ************************************************************************
const chat = function(){
Expand Down Expand Up @@ -40,7 +42,7 @@ const chat = function(){

try {
// the back-end returns the timezone formatted not according to tz identifier, so I'm going to risk the 'replace' here to make it work with .toLocaleString automatically
timezonedDate = date.toLocaleString('en-US', { day: 'numeric', weekday: 'short', year: 'numeric', month: 'short', hour: 'numeric', minute: 'numeric', hour12: true, timeZone: posChat.profile.timezone.friendly_name_with_region.replace(' - ', '/') });
timezonedDate = date.toLocaleString('en-US', { day: 'numeric', weekday: 'short', year: 'numeric', month: 'short', hour: 'numeric', minute: 'numeric', hour12: true, timeZone: window.pos.profile.timezone.friendly_name_with_region.replace(' - ', '/') });
} catch {
if(typeof Intl == 'object' && typeof Intl.NumberFormat == 'function'){
timezonedDate = date.toLocaleString('en-US', { day: 'numeric', weekday: 'short', year: 'numeric', month: 'short', hour: 'numeric', minute: 'numeric', hour12: true, timeZone: 'Etc/UTC' });
Expand All @@ -64,16 +66,14 @@ const chat = function(){
};
// the id of the currently logged user (string)
module.settings.currentUserId = module.settings.messageInput.getAttribute('data-current-profile-id');
// converting the dates to user timezone if set in profile (string)
module.settings.currentUserTimezone = posChat.profile.timezone;
// the loading indicator when loading messages (dom node)
module.settings.loadingIndicator = document.querySelector('#pos-chat-loadingIndicator');
// current page of messages (int)
module.settings.currentPage = 1;
// are there more pages (bool)
module.settings.morePages = posChat.previousPageAvailable || true;
module.settings.morePages = true
// the message that will appear when the connection is lost
module.settings.lostConnection = posChat.strings.connectionError;
module.settings.lostConnection = pos.translations.connectionError;

// the channel to send messages through (Action Cable channel)
module.channel = null;
Expand Down Expand Up @@ -113,7 +113,7 @@ const chat = function(){
room_id: module.conversationId,
sender_name: module.settings.messageInput.getAttribute('data-from-name'),
autor_id: module.settings.messageInput.getAttribute('data-current-profile-id'),
authenticity_token: posChat.csrfToken
authenticity_token: window.pos.csrfToken
},
{
received: function(data){
Expand Down
2 changes: 1 addition & 1 deletion modules/chat/public/assets/js/consumer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createConsumer } from "https://unpkg.com/@rails/[email protected]/app/assets/javascripts/actioncable.esm.js";

const getWebSocketURL = () => {
return `/websocket?authenticity_token=${posChat.csrfToken}`;
return `/websocket?authenticity_token=${window.pos.csrfToken}`;
};

export default createConsumer(getWebSocketURL);
27 changes: 20 additions & 7 deletions modules/chat/public/views/partials/inbox.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,29 @@
</script>

<script>
let posChat = {};
posChat.csrfToken = '{{ context.authenticity_token }}';
posChat.profile = {};
posChat.profile.timezone = {% if current_profile.timezone %} {{ current_profile.timezone }} {% else %} null {% endif %};
/* namespace */
if(typeof window.pos !== 'object'){
window.pos = {};
window.pos.modules = {};
window.pos.translations = {};
}

posChat.strings = {
connectionError: '{{ 'modules/chat/error_connection' | t }}'
if(typeof window.pos.csrfToken !== 'string'){
window.pos.csrfToken = '{{ context.authenticity_token }}';
}

/* profile namespace */
if(typeof window.pos.profile !== 'object'){
window.pos.profile = {};
}

posChat.previousPageAvailable = true;
window.pos.profile.timezone = {% if current_profile.timezone %} {{ current_profile.timezone }} {% else %} null {% endif %};

/* translations used in module */
window.pos.translations = {
...window.pos.translations,
connectionError: '{{ 'modules/chat/error_connection' | t }}'
}
</script>
<script type="module" defer src="{{ 'modules/chat/js/chat.js' | asset_url }}"></script>

Expand Down
Loading