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

feat: Homepage new design, news feed #6642

Merged
merged 27 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9d455ec
new design in homepage
zhixzhan Mar 31, 2021
e54347b
update
zhixzhan Mar 31, 2021
3eb7689
update
zhixzhan Apr 1, 2021
5c56f4f
add feeds
zhixzhan Apr 1, 2021
2e1224c
feed server api
zhixzhan Apr 1, 2021
c2c3b15
update
zhixzhan Apr 1, 2021
a32d299
fix when fetch error
zhixzhan Apr 1, 2021
a19cb38
update tests
zhixzhan Apr 1, 2021
ca216c9
update styles
zhixzhan Apr 2, 2021
47ce78f
add tests
zhixzhan Apr 2, 2021
5fad63e
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 2, 2021
3d2da34
verify feed version
zhixzhan Apr 2, 2021
58d08fd
no border line above empty box
zhixzhan Apr 6, 2021
ea2d6ba
fetch feed once.
zhixzhan Apr 6, 2021
093e2e7
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 6, 2021
0350831
update styles
zhixzhan Apr 6, 2021
2f5e4f4
update
zhixzhan Apr 6, 2021
0430e18
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 6, 2021
a05b31c
handle aka.ms redirect
zhixzhan Apr 6, 2021
5352083
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 6, 2021
b4f2cf8
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 6, 2021
bb96ac1
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 7, 2021
c126de1
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 7, 2021
44eb623
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 7, 2021
fe8161b
update feed url
zhixzhan Apr 7, 2021
1432b42
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 7, 2021
29de833
Merge branch 'main' into zhixzhan/homepage-refine
zhixzhan Apr 7, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('<CreationFlow/>', () => {
fetchTemplateProjects: jest.fn(),
onboardingAddCoachMarkRef: jest.fn(),
fetchRecentProjects: jest.fn(),
fetchFeed: jest.fn(),
fetchTemplates: jest.fn(),
setCreationFlowStatus: jest.fn(),
navTo: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('<CreationFlowV2/>', () => {
fetchTemplateProjects: jest.fn(),
onboardingAddCoachMarkRef: jest.fn(),
fetchRecentProjects: jest.fn(),
fetchFeed: jest.fn(),
fetchTemplates: jest.fn(),
setCreationFlowStatus: jest.fn(),
navTo: jest.fn(),
Expand Down
51 changes: 38 additions & 13 deletions Composer/packages/client/__tests__/components/home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import * as React from 'react';
import { fireEvent, render } from '@botframework-composer/test-utils';
import { Toolbar } from '@bfc/ui-shared';
import { BotTemplate } from '@bfc/shared';

import { RecentBotList } from '../../src/pages/home/RecentBotList';
import { ExampleList } from '../../src/pages/home/ExampleList';
import { WhatsNewsList } from '../../src/pages/home/WhatsNewsList';
import { CardWidget } from '../../src/pages/home/CardWidget';
import { renderWithRecoil } from '../testUtils';

describe('<Home/>', () => {
Expand All @@ -29,17 +29,22 @@ describe('<Home/>', () => {
}
});

it('should dispatch onClick event when clicked on an ExampleList', () => {
const templates = [
{ description: 'echo bot', id: 'EchoBot', name: 'Echo Bot' },
{ description: 'empty bot', id: 'EmptyBot', name: 'Empty Bot' },
] as BotTemplate[];
const onClickTemplate = jest.fn((item) => item);
const { container, getByText } = render(<ExampleList examples={templates} onClick={onClickTemplate} />);
expect(container).toHaveTextContent('Echo Bot');
const link = getByText('Echo Bot');
fireEvent.click(link);
expect(onClickTemplate.mock.results[0].value).toBe('EchoBot');
it("should render what's news List", () => {
const newsList = [
{
title: 'Composer 1.4',
description: "Learn about new features in Composer's latest release.",
url: 'https://www.microsoft.com',
},
{
title: 'Conversational AI at Microsoft Ignite',
description:
'Updates from Microsoft Ignite. New Composer release, public preview of Orchestrator and updates to Azure Bot Service and Bot Framework SDK.',
url: 'https://www.microsoft.com',
},
];
const { container } = render(<WhatsNewsList newsList={newsList} />);
expect(container).toHaveTextContent(newsList[0].description);
});

it('should call onClick handler when clicked', () => {
Expand Down Expand Up @@ -90,4 +95,24 @@ describe('<Home/>', () => {
fireEvent.click(link);
expect(setCreationFlowStatus.mock.results[0].value).toBe('NEW');
});

it('should render resoure, article, video cards', () => {
const videoItem = {
image: 'https://via.placeholder.com/244x95/0078d4/ffffff?text=Bot+FrameWork+Composer',
title: 'Introduction to Composer',
description: 'A five minute intro to Composer',
url: 'https://www.youtube.com/watch?v=hiIiZnRcCv0',
};
const { container } = renderWithRecoil(
<CardWidget
ariaLabel="test"
cardType={'video'}
content={videoItem.description}
href={videoItem.url}
imageCover={videoItem.image}
title={videoItem.title}
/>
);
expect(container).toHaveTextContent(videoItem.title);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const CreationFlow: React.FC<CreationFlowProps> = (props: CreationFlowProps) =>
fetchTemplates,
fetchTemplatesV2,
fetchRecentProjects,
fetchFeed,
fetchStorages,
fetchFolderItemsByPath,
setCreationFlowStatus,
Expand Down Expand Up @@ -77,6 +78,7 @@ const CreationFlow: React.FC<CreationFlowProps> = (props: CreationFlowProps) =>
await fetchProjectById(cachedProjectId);
}
await fetchStorages();
fetchFeed();
fetchRecentProjects();
featureFlags.NEW_CREATION_FLOW?.enabled ? fetchTemplatesV2([feedDictionary[csharpFeedKey]]) : fetchTemplates();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const CreationFlowV2: React.FC<CreationFlowProps> = () => {
updateFolder,
saveTemplateId,
fetchRecentProjects,
fetchFeed,
openProject,
saveProjectAs,
fetchProjectById,
Expand Down Expand Up @@ -75,7 +76,7 @@ const CreationFlowV2: React.FC<CreationFlowProps> = () => {
await fetchProjectById(cachedProjectId);
}
await fetchStorages();

fetchFeed();
fetchRecentProjects();
};

Expand Down
2 changes: 2 additions & 0 deletions Composer/packages/client/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { IDropdownOption } from 'office-ui-fabric-react/lib/Dropdown';
export const BASEPATH = process.env.PUBLIC_URL || '/';
export const BASEURL = `${process.env.PUBLIC_URL || ''}/api`;

export const FEEDVERSION = 1;

//the count about the undo/redo
export const UNDO_LIMIT = 10;

Expand Down
3 changes: 3 additions & 0 deletions Composer/packages/client/src/images/composerDocumentIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Composer/packages/client/src/images/defaultVideoCardCover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Composer/packages/client/src/images/githubIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions Composer/packages/client/src/images/noRecentBotsCover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading