Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
31 changes: 30 additions & 1 deletion app/containers/LoginServices/LoginServices.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ServicesSeparator from './ServicesSeparator';
import ButtonService from './ButtonService';
import { type IServices } from '../../selectors/login';
import { type TIconsName } from '../CustomIcon';
import ServiceList from './ServiceList';

const styles = StyleSheet.create({
serviceName: {
Expand Down Expand Up @@ -71,7 +72,7 @@ export const Separators = () => (
</>
);

export const ServiceList = () => (
export const ServicesList = () => (
<>
{Object.values(services).map(service => {
const icon = `${service.name}-monochromatic` as TIconsName;
Expand All @@ -94,3 +95,31 @@ export const ServiceList = () => (
})}
</>
);

export const ServiceListCollapsed = () => {
return (
<ServiceList
services={services}
CAS_enabled={false}
CAS_login_url=''
Gitlab_URL=''
server='https://demo.rocket.chat'
collapsed={true}
showLoginOnWebButton={true}
/>
);
};

export const ServiceListUncollapsed = () => {
return (
<ServiceList
services={services}
CAS_enabled={false}
CAS_login_url=''
Gitlab_URL=''
server='https://demo.rocket.chat'
collapsed={false}
showLoginOnWebButton={true}
/>
);
};
2 changes: 2 additions & 0 deletions app/containers/LoginServices/LoginServices.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { generateSnapshots } from '../../../.rnstorybook/generateSnapshots';
import * as stories from './LoginServices.stories';

jest.mock('../../lib/services/connect', () => ({}));
Comment thread
yash-rajpal marked this conversation as resolved.

generateSnapshots(stories);
47 changes: 47 additions & 0 deletions app/containers/LoginServices/ServiceList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Linking } from 'react-native';

import Service from './Service';
import Button from '../Button';
import { type IServiceList, type IItemService } from './interfaces';
import I18n from '../../i18n';

const ServiceList = ({
services,
CAS_enabled,
CAS_login_url,
Gitlab_URL,
server,
collapsed,
showLoginOnWebButton
}: IServiceList & { showLoginOnWebButton: boolean }) => {
const enableLoginOnWebButton = showLoginOnWebButton && (!collapsed || Object.keys(services).length <= 2);
Comment thread
yash-rajpal marked this conversation as resolved.
Outdated

return (
<>
{Object.values(services).map((service: IItemService, index: number) => {
if (index > 2 && collapsed) return null;

return (
<Service
key={service._id}
CAS_enabled={CAS_enabled}
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
service={service}
/>
);
})}
{enableLoginOnWebButton && (
Comment thread
yash-rajpal marked this conversation as resolved.
Outdated
<Button
title={I18n.t('Login_on_web')}
onPress={() => {
Linking.openURL(`${server}/home?loginClient=mobile`);
}}
/>
)}
</>
);
};

export default ServiceList;
Loading
Loading