From 1ea8b22a592abb5f1eede91bab22b3b63636dc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 7 Aug 2023 18:16:14 +0200 Subject: [PATCH] WIP Add service page for Chat --- app/controllers/services/chat_controller.rb | 14 +++ app/javascript/controllers/application.js | 3 +- app/views/dashboard/index.html.erb | 2 +- app/views/services/chat/show.html.erb | 98 +++++++++++++++++++++ config/routes.rb | 2 + 5 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 app/controllers/services/chat_controller.rb create mode 100644 app/views/services/chat/show.html.erb diff --git a/app/controllers/services/chat_controller.rb b/app/controllers/services/chat_controller.rb new file mode 100644 index 0000000..dfc69e3 --- /dev/null +++ b/app/controllers/services/chat_controller.rb @@ -0,0 +1,14 @@ +class Services::ChatController < Services::BaseController + before_action :authenticate_user! + before_action :require_service_available + + def show + @service_enabled = current_user.services_enabled.include?(:xmpp) + end + + private + + def require_service_available + http_status :not_found unless Setting.ejabberd_enabled? + end +end diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js index 97645a6..f93adf1 100644 --- a/app/javascript/controllers/application.js +++ b/app/javascript/controllers/application.js @@ -1,9 +1,10 @@ import { Application } from "@hotwired/stimulus" -import { Modal } from "tailwindcss-stimulus-components" +import { Modal, Tabs } from "tailwindcss-stimulus-components" const application = Application.start() application.register('modal', Modal) +application.register('tabs', Tabs) // Configure Stimulus development experience application.debug = false diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 590361b..a1ac038 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -10,7 +10,7 @@
- <%= link_to "https://wiki.kosmos.org/Services:Chat", + <%= link_to services_chat_path, class: "block h-full px-6 py-6 rounded-md" do %>

Chat

diff --git a/app/views/services/chat/show.html.erb b/app/views/services/chat/show.html.erb new file mode 100644 index 0000000..4e26dd6 --- /dev/null +++ b/app/views/services/chat/show.html.erb @@ -0,0 +1,98 @@ +<%= render HeaderComponent.new(title: "Chat") %> + +<%= render MainSimpleComponent.new do %> +

+

+ Chat with anyone on the open Jabber network. Message people directly, or + join public channels or private rooms. +

+
+
+

Your Chat Address

+

+ When you exchange contacts with people, give them your + address, or add them using their address: +

+

+ disabled="disabled" + data-clipboard-target="source" /> + +

+
+
+

Chat Apps

+

+ Use your Kosmos account with many different apps, and on any devices + you wish! When opening an app for the first time, just enter your + user address and password to log in. +

+
+
+

Recommended Apps

+
+ + + + + + + + +
+
+<% end %> diff --git a/config/routes.rb b/config/routes.rb index 7d51379..ec98cb3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -21,6 +21,8 @@ Rails.application.routes.draw do namespace :services do get 'storage', to: 'remotestorage#dashboard' + resource :chat, only: [:show], controller: 'chat' + resources :lightning, only: [:index] do collection do get 'transactions'