зеркало из https://github.com/microsoft/art.git
Add favorite matches
This commit is contained in:
Родитель
8eaa007be2
Коммит
da7fb925a6
15
README.md
15
README.md
|
@ -62,7 +62,20 @@ To cite this work please use the following:
|
|||
|
||||
Please see our [developer guide](./developer_guide.mg) to build the project for yourself/
|
||||
|
||||
# Our Favorite Matches
|
||||
## Some Favorite Matches
|
||||
|
||||
Shared portreyals of reverance over 3000 years:
|
||||
|
||||
<p align="center">
|
||||
<img src="./media/match1.jpg" width=70%/>
|
||||
</p>
|
||||
|
||||
How to match your watch to your ourfit and your dinnerware:
|
||||
|
||||
<p align="center">
|
||||
<img src="./media/match2.jpg" width=70%/>
|
||||
</p>
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
export const defaultArtworks = [
|
||||
|
||||
{
|
||||
"id": "NjQ0Mg==",
|
||||
"Thumbnail_Url": "https://mmlsparkdemo.blob.core.windows.net/met/thumbnails/6442.jpg",
|
||||
"Title": "Plate",
|
||||
"defaultCulture": "russian",
|
||||
"defaultMedium": "photographs",
|
||||
},
|
||||
{
|
||||
"Thumbnail_Url": "https://mmlsparkdemo.blob.core.windows.net/rijks/resized_images/SK-A-3064.jpg",
|
||||
"id": "U0stQS0zMDY0",
|
||||
|
@ -106,14 +114,13 @@ export const defaultArtworks = [
|
|||
"defaultMedium": "prints"
|
||||
},
|
||||
|
||||
|
||||
//non-default selection
|
||||
{
|
||||
"id": "MjM2NzUw",
|
||||
"Thumbnail_Url": "https://mmlsparkdemo.blob.core.windows.net/met/thumbnails/236750.jpg",
|
||||
"Title": "Wine cooler with A Marine Triumph of Bacchus",
|
||||
"defaultCulture": "greek",
|
||||
"defaultMedium": "woodwork"
|
||||
"defaultMedium": "woodwork",
|
||||
"defaultResultId": "MjA3Njgx"
|
||||
},
|
||||
{
|
||||
"id": "MjAyNTU0",
|
||||
|
@ -127,11 +134,10 @@ export const defaultArtworks = [
|
|||
"Thumbnail_Url": "https://mmlsparkdemo.blob.core.windows.net/met/thumbnails/25402.jpg",
|
||||
"Title": "Saddle",
|
||||
"defaultCulture": "american",
|
||||
"defaultMedium": "stone"
|
||||
"defaultMedium": "stone",
|
||||
"defaultResultId": "NDQ5ODEx"
|
||||
},
|
||||
|
||||
// GTG
|
||||
|
||||
{
|
||||
"id": "UlAtVC0xOTE0LTE3LTMxNg==",
|
||||
"Thumbnail_Url": "https://mmlsparkdemo.blob.core.windows.net/rijks/resized_images/RP-T-1914-17-316.jpg",
|
||||
|
@ -176,6 +182,15 @@ export const defaultArtworks = [
|
|||
"defaultMedium": "metalwork"
|
||||
|
||||
},
|
||||
{
|
||||
"id": "MTk0MTEz",
|
||||
"Thumbnail_Url": "https://mmlsparkdemo.blob.core.windows.net/met/thumbnails/194113.jpg",
|
||||
"Title": "The Great Ruby Watch",
|
||||
"defaultCulture": "chinese",
|
||||
"defaultMedium": "textiles",
|
||||
"defaultResultId": "QkstQlItNjA5",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]
|
||||
|
|
|
@ -105,11 +105,11 @@ export default class ExplorePage extends React.Component<IProps, IState> {
|
|||
*/
|
||||
setResultArtwork(newResultArtwork: ArtMatch): void {
|
||||
let self = this;
|
||||
this.updateBestMatch(self, newResultArtwork)
|
||||
this.updateBestMatch(self, newResultArtwork.id!)
|
||||
}
|
||||
|
||||
updateBestMatch(component: any, match: ArtMatch) {
|
||||
lookup(match.id!)
|
||||
updateBestMatch(component: any, id: string) {
|
||||
lookup(id)
|
||||
.then(function (responseJson) {
|
||||
component.setState({
|
||||
chosenArtwork: new ArtObject(
|
||||
|
@ -131,7 +131,9 @@ export default class ExplorePage extends React.Component<IProps, IState> {
|
|||
this.setState({
|
||||
cultureFilter: idToArtwork[artworkID].defaultCulture || this.state.cultureFilter,
|
||||
mediumFilter: idToArtwork[artworkID].defaultMedium || this.state.mediumFilter
|
||||
}, () => this.executeQuery(artworkID!, false));
|
||||
}, () => {
|
||||
this.executeQuery(artworkID!, false)
|
||||
});
|
||||
} else {
|
||||
this.executeQuery(artworkID!, false);
|
||||
};
|
||||
|
@ -170,12 +172,20 @@ export default class ExplorePage extends React.Component<IProps, IState> {
|
|||
mediumItems: mediumMatches
|
||||
});
|
||||
if (promoteCultureMatch) {
|
||||
return cultureMatches[0]
|
||||
return cultureMatches
|
||||
} else {
|
||||
return mediumMatches[0]
|
||||
return mediumMatches
|
||||
}
|
||||
})
|
||||
.then(function (matches) {
|
||||
if (artworkID in idToArtwork
|
||||
&& "defaultResultId" in idToArtwork[artworkID]
|
||||
&& matches.map(m => m.id!).indexOf(idToArtwork[artworkID].defaultResultId) >= 0) {
|
||||
self.updateBestMatch(self, idToArtwork[artworkID].defaultResultId)
|
||||
} else {
|
||||
self.updateBestMatch(self, matches[0].id!)
|
||||
}
|
||||
})
|
||||
.then(function (match) { self.updateBestMatch(self, match) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,7 +69,6 @@ export function queryBase(query: string): Promise<any> {
|
|||
}
|
||||
|
||||
export function lookupBase(artworkID: string, selectors: string[]): Promise<any> {
|
||||
console.log(artworkID)
|
||||
return queryBase(`/${artworkID}?api-version=${apiVersion}&$select=${selectors.join(",")}`)
|
||||
}
|
||||
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 388 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 495 KiB |
Загрузка…
Ссылка в новой задаче