Skip to content

Commit

Permalink
Fixes to avoid console errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GuidoZam committed Jun 18, 2022
1 parent 04adb1f commit 9f17376
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 24 deletions.
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/node_modules": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class RecentFilesAceAdaptiveCardExtension extends BaseAdaptiveCar
currentIndex: 0,
oneDriveUrl: "https://onedrive.com/",
isLoading: true
};
};

this.cardNavigator.register(CARD_VIEW_REGISTRY_ID, () => new CardView());
this.quickViewNavigator.register(QUICK_VIEW_REGISTRY_ID, () => new QuickView());
Expand Down
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.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { IRecentFilesAceAdaptiveCardExtensionProps, IRecentFilesAceAdaptiveCardE
import * as MicrosoftGraph from '@microsoft/microsoft-graph-types';

export interface IQuickViewData {
subTitle: string;
title: string;
recents: MicrosoftGraph.DriveItem[];
currentFile: MicrosoftGraph.DriveItem;
isFirstElement: boolean;
isLastElement: boolean;
subTitle: string;
title: string;
recents: MicrosoftGraph.DriveItem[];
currentFile: MicrosoftGraph.DriveItem;
isFirstElement: boolean;
isLastElement: boolean;
previousIcon: string;
nextIcon: string;
}

export class QuickView extends BaseAdaptiveCardView<
Expand All @@ -20,13 +22,24 @@ export class QuickView extends BaseAdaptiveCardView<
public get data(): IQuickViewData {
const currentFile = this.getCurrentFile();
return {
subTitle: strings.SubTitle,
title: strings.Title,
recents: (this.state.recents && this.state.recents.length > 0) ? this.state.recents : [],
currentFile: currentFile,
isFirstElement: (this.state.recents && this.state.recents.length > 0) ? (this.state.recents.indexOf(currentFile) == 0) : true,
isLastElement: (this.state.recents && this.state.recents.length > 0) ? (this.state.recents.indexOf(currentFile) == (this.state.recents.length - 1)) : true
};
subTitle: strings.SubTitle,
title: strings.Title,
recents:
this.state.recents && this.state.recents.length > 0
? this.state.recents
: [],
currentFile: currentFile,
isFirstElement:
this.state.recents && this.state.recents.length > 0
? this.state.recents.indexOf(currentFile) == 0
: true,
isLastElement:
this.state.recents && this.state.recents.length > 0
? this.state.recents.indexOf(currentFile) == this.state.recents.length - 1
: true,
previousIcon: require("../assets/previous.png"),
nextIcon: require("../assets/next.png"),
};
}

private getCurrentFile = (): MicrosoftGraph.DriveItem => {
Expand All @@ -40,7 +53,6 @@ export class QuickView extends BaseAdaptiveCardView<
}

public get template(): ISPFxAdaptiveCard {
console.log(this.data);
return require('./template/QuickViewTemplate.json');
}

Expand All @@ -67,7 +79,5 @@ export class QuickView extends BaseAdaptiveCardView<
break;
}
}

// TODO: hide or disable the button when reached the last item in the array?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"items": [
{
"type": "Image",
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAedJREFUWEfFl7/LQVEYx7+3LJJFGawWdhnkD7BYDCY2i0zya7nCqEhKmWTyY2NR8gfIIDuLlSKLJCn37Tx1b+e975u3F/eeM93t+dznfJ7vOUdSFEWBwCUdj0clFothNpuh1+uBfRu9LpcL+v0+otEoTAdYr9fI5/O43+8EYRrA7XbDYDBALpfD6XRCKBQyD2C/30OWZXS7XW13TQF4PB6YTqfIZrPYbDZU3OVyYbfbGd+B8/mMarWKVqsF9u1wOFCv18GGLpFIGAfACqxWK6TTacznc/rrcDiMWq0Gr9dL+x6Px40BYKJ1Oh2USiUSzW63k/GZTAY2m41gDAPYbrdk+Hg8pkJ+vx/NZhOBQACSJGnyfRyAiTYajVAsFjXRUqkUKpUKnE7nj0z7KMDhcKBC7XabCnk8HpTLZUo4i8Xya6B+BICJtlgsSLTlckmFIpEIWe52u58m+dsALMcbjQZZrY4Xa38ymYTVav3zGHkLQM3xyWRChYLBIInm8/m+ifaM4iUAfY6z8WKiFQoFCpj/rJcArtcrhsMhzbQ636YCqH8obAv4FguVUAUROoZ8N4QFEQ8hNIp5EGGHEQ8h9DjmBRV2IeG7IexKphdU2KWUBxF2LdcLKuxhwoMIe5rpzxPtcSr6ef4FJTDpHSIDsz8AAAAASUVORK5CYII=",
"url": "${previousIcon}",
"width": "20px",
"$when": "${$root.isFirstElement == false}"
}
Expand Down Expand Up @@ -61,14 +61,15 @@
"items": [
{
"type": "Image",
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAeBJREFUWEfFl7+rQWEYx79HSZJFKVYLuwzyB0hZ2PyYZFJKogySRCk/UsrExqRYLP4AGWRnsRroLDJYnNv71LHc7rkux33e6e0s38953+/3eZ5XUhRFAeOSZFlWptMpEokELBbLx1EmkwmSySSCwSDEXjqfz4oQNxqNaLVa8Hg8H4X4EWC5XMJms6HdbiMej8NkMn0ERBNAVUylUmg0GnA4HLpDaAI4nU4cj0cSdbvd6HQ6CIVCMBgMuoFoAoxGI0iShEKhAFmWYbVakc1mUSqVaK/H0gQYj8eUht1uh2KxiMViQZqBQAC9Xg9er5cA31lPAQiB6/WKbrdLybhcLmTQWq2GdDr9lkGfBhAQokat12vkcjlsNhv68UgkQklxuVwvHcSfAFSF0+mEarWKwWDwMGi9Xkc0Gv2zQV8CEKr3+x2z2Qzlchn7/Z5AMpkMgdnt9qdP42UAVeFwOFBK5vM5ffL5fGRQv9//lEHfBhCit9sNw+EQlUrlEVeRmnw+/2s/0QVANeh2uyWDrlYrOo1wOPxrP9ENQL0SEdFms4l+v/+Iq1Y/+RcAUTtisRjMZvM3c+oGIGoE2xWwmpAthqyFiK0UszYj1nbMNpCwj2TsQyn7WM76MGF7mrE/Trmf519Ap60ReTNQbwAAAABJRU5ErkJggg==",
"url": "${nextIcon}",
"width": "20px",
"selectAction": {
"type": "Action.Submit",
"id": "next"
}
"$when": "${$root.isLastElement == false}"
}
]
],
"selectAction": {
"type": "Action.Submit",
"id": "next"
}
}
]
},
Expand Down

0 comments on commit 9f17376

Please sign in to comment.