+
+ >;
+}
+
+JoinButton.propTypes = {
+ tribe: PropTypes.object.isRequired,
+ user: PropTypes.object,
+ onUpdated: PropTypes.func.isRequired,
+};
diff --git a/modules/tribes/client/components/LeaveTribeModal.js b/modules/tribes/client/components/LeaveTribeModal.js
new file mode 100644
index 0000000000..881858d2f0
--- /dev/null
+++ b/modules/tribes/client/components/LeaveTribeModal.js
@@ -0,0 +1,35 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { useTranslation } from 'react-i18next';
+import { Modal } from 'react-bootstrap';
+
+export default function LeaveTribeModal({ tribe, show, onConfirm, onCancel }) {
+
+ const { t } = useTranslation('tribes');
+
+ return (
+
+
+
+ {t('Leave this Tribe?')}
+
+
+
+ {t('Do you want to leave "{{label}}"?', { label: tribe.label })}
+
+
+
+
+
+
+
+
+ );
+}
+
+LeaveTribeModal.propTypes = {
+ show: PropTypes.bool.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ onCancel: PropTypes.func.isRequired,
+ tribe: PropTypes.object.isRequired,
+};
diff --git a/modules/tribes/client/controllers/tribes-list.client.controller.js b/modules/tribes/client/controllers/tribes-list.client.controller.js
index e15e6c01e2..e2363cb2fa 100644
--- a/modules/tribes/client/controllers/tribes-list.client.controller.js
+++ b/modules/tribes/client/controllers/tribes-list.client.controller.js
@@ -3,7 +3,7 @@ angular
.controller('TribesListController', TribesListController);
/* @ngInject */
-function TribesListController(tribes, $state, Authentication, TribeService, $scope) {
+function TribesListController(tribes, $state, Authentication, TribeService, $rootScope, $scope) {
// ViewModel
const vm = this;
@@ -12,6 +12,16 @@ function TribesListController(tribes, $state, Authentication, TribeService, $sco
vm.tribes = tribes;
vm.user = Authentication.user;
vm.openTribe = openTribe;
+ vm.broadcastChange = function (data) {
+ if (data.tribe) {
+ $rootScope.$broadcast('tribeUpdated', data.tribe);
+ }
+
+ if (data.user) {
+ Authentication.user = data.user;
+ $rootScope.$broadcast('userUpdated');
+ }
+ };
/**
* Open tribe
diff --git a/modules/tribes/client/views/tribes-list.client.view.html b/modules/tribes/client/views/tribes-list.client.view.html
index 6c9cfc7934..6c262cd7de 100644
--- a/modules/tribes/client/views/tribes-list.client.view.html
+++ b/modules/tribes/client/views/tribes-list.client.view.html
@@ -38,11 +38,13 @@
-
-
+ user="app.user"
+ icon="true"
+ onUpdated="tribesList.broadcastChange"
+ >