feedback changes incorporated

Signed-off-by: Abhay-soni-developer <abhaysoni.developer@gmail.com>
This commit is contained in:
Abhay-soni-developer
2023-02-07 03:30:11 +05:30
committed by blam
parent 6d0eb9e962
commit 5e7293f93e
10 changed files with 30 additions and 60 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
---
'@backstage/plugin-microsoft-calendar': patch
'@backstage/plugin-microsoft-calendar': minor
---
created new plugin @backstage/plugin-microsoft-calendar and added it to plugins directory
updated example-app homepage to show microsoft-calendar widget.
Created a new Frontend plugin @backstage/plugin-microsoft-calendar and added it to plugins directory.
please refer to readme (readme.md)[./../plugins/microsoft-calendar/README.md] for step wise instruction to setup the plugin in your backstage frontend app.
@@ -27,7 +27,7 @@ import {
import { Content, Header, Page } from '@backstage/core-components';
import { HomePageSearchBar } from '@backstage/plugin-search';
import { HomePageCalendar } from '@backstage/plugin-gcalendar';
import { MicrosoftCalendar } from '@backstage/plugin-microsoft-calendar';
import { MicrosoftCalendarCard } from '@backstage/plugin-microsoft-calendar';
import Grid from '@material-ui/core/Grid';
import React from 'react';
@@ -116,7 +116,7 @@ export const homePage = (
<HomePageCalendar />
</Grid>
<Grid item xs={12} md={4}>
<MicrosoftCalendar />
<MicrosoftCalendarCard />
</Grid>
<Grid item xs={12} md={4}>
<HomePageStarredEntities />
+3 -3
View File
@@ -11,9 +11,6 @@ import { Event as Event_2 } from '@microsoft/microsoft-graph-types';
import { FetchApi } from '@backstage/core-plugin-api';
import { OAuthApi } from '@backstage/core-plugin-api';
// @public (undocumented)
export const MicrosoftCalendar: () => JSX.Element;
// @public (undocumented)
export class MicrosoftCalendarApiClient {
constructor(options: { authApi: OAuthApi; fetchApi: FetchApi });
@@ -35,5 +32,8 @@ export class MicrosoftCalendarApiClient {
// @public (undocumented)
export const microsoftCalendarApiRef: ApiRef<MicrosoftCalendarApiClient>;
// @public (undocumented)
export const MicrosoftCalendarCard: () => JSX.Element;
// (No @packageDocumentation comment for this package)
```
+2 -2
View File
@@ -15,7 +15,7 @@
*/
import React from 'react';
import { createDevApp } from '@backstage/dev-utils';
import { microsoftCalendarPlugin, MicrosoftCalendar } from '../src/plugin';
import { microsoftCalendarPlugin, MicrosoftCalendarCard } from '../src/plugin';
import { microsoftCalendarApiRef } from '../src';
import responseMock from './mock.json';
import { microsoftAuthApiRef } from '@backstage/core-plugin-api';
@@ -52,7 +52,7 @@ createDevApp()
<Page themeId="home">
<Content>
<Grid item xs={12} md={6}>
<MicrosoftCalendar />
<MicrosoftCalendarCard />
</Grid>
</Content>
</Page>
@@ -131,11 +131,7 @@ export const CalendarCard = () => {
</Box>
)}
{sortBy(events, [getStartDate]).map(event => (
<CalendarEvent
key={`${event.id}`}
event={event}
// calendar={calendars}
/>
<CalendarEvent key={`${event.id}`} event={event} />
))}
</Box>
)}
@@ -71,11 +71,11 @@ const useStyles = makeStyles(
backgroundColor: theme.palette.grey[100],
},
},
calendarColor: () => ({
calendarColor: {
width: 8,
borderTopLeftRadius: 4,
borderBottomLeftRadius: 4,
}),
},
}),
{
name: 'MicrosoftCalendarEvent',
@@ -83,7 +83,7 @@ const useStyles = makeStyles(
);
export const CalendarEvent = ({ event }: { event: MicrosoftCalendarEvent }) => {
const classes = useStyles({ event });
const classes = useStyles();
const popoverState = usePopupState({
variant: 'popover',
popupId: event.id,
@@ -33,21 +33,19 @@ import { MicrosoftCalendarEvent } from '../api';
import { getTimePeriod, getOnlineMeetingLink } from './util';
const useStyles = makeStyles(
theme => {
return {
description: {
wordBreak: 'break-word',
'& a': {
color: theme.palette.primary.main,
fontWeight: 500,
},
theme => ({
description: {
wordBreak: 'break-word',
'& a': {
color: theme.palette.primary.main,
fontWeight: 500,
},
divider: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
};
},
},
divider: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
},
}),
{
name: 'GCalendarEventPopoverContent',
},
@@ -60,7 +58,7 @@ type CalendarEventPopoverProps = {
export const CalendarEventPopoverContent = ({
event,
}: CalendarEventPopoverProps) => {
const classes = useStyles({ event });
const classes = useStyles();
const onlineMeetingLink = getOnlineMeetingLink(event);
return (
+1 -1
View File
@@ -13,5 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { MicrosoftCalendar } from './plugin';
export { MicrosoftCalendarCard } from './plugin';
export { MicrosoftCalendarApiClient, microsoftCalendarApiRef } from './api';
+2 -6
View File
@@ -24,13 +24,9 @@ import {
microsoftCalendarApiRef,
MicrosoftCalendarApiClient,
} from './api/index';
import { rootRouteRef } from './routes';
export const microsoftCalendarPlugin = createPlugin({
id: 'microsoft-calendar',
routes: {
root: rootRouteRef,
},
apis: [
createApiFactory({
api: microsoftCalendarApiRef,
@@ -43,9 +39,9 @@ export const microsoftCalendarPlugin = createPlugin({
});
/** @public */
export const MicrosoftCalendar = microsoftCalendarPlugin.provide(
export const MicrosoftCalendarCard = microsoftCalendarPlugin.provide(
createComponentExtension({
name: 'MicrosoftCalendar',
name: 'MicrosoftCalendarCard',
component: {
lazy: () => import('./components').then(m => m.MicrosoftCalendar),
},
-20
View File
@@ -1,20 +0,0 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createRouteRef } from '@backstage/core-plugin-api';
export const rootRouteRef = createRouteRef({
id: 'microsoft-calendar',
});