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

slick 5:4 and 4:5 crop sharing from composer to fronts tool #312

Merged
merged 21 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d4a1c05
allow looking up pinboards (workflow stubs) by path, via `workflow-br…
twrichards Oct 4, 2024
e9a82ae
add counts for `totalCropCount`, `fiveByFourCount` and `fourByFiveCou…
twrichards Oct 8, 2024
c4c0294
fronts integration PLUS 'suggest alternate crops' buttons (for compos…
twrichards Oct 10, 2024
ecac1a5
display draggable thumbs when the `<pinboard-article-button>` has a `…
twrichards Oct 14, 2024
921691a
display count of already suggested crops beneath `Suggest an alternat…
twrichards Oct 15, 2024
ff1dea2
[fronts integration] handle when there are no counts for a pinboard, …
twrichards Oct 15, 2024
a282d12
add style block to add gutters to composer trail image thumbnail (ext…
twrichards Oct 17, 2024
e47c750
display existing suggested alternate crop thumbnails in a tooltip on …
twrichards Oct 21, 2024
32094ae
refactor/simplify `peekAtPinboard` functionality, and use in the fron…
twrichards Oct 22, 2024
0ec982c
remove unread counts from pinboard buttons in fronts as not really ne…
twrichards Oct 23, 2024
1358792
add option item id to highlight when using `peekAtPinboard`
twrichards Oct 24, 2024
86ba453
place all the new crop suggesting functionality behind a new feature …
twrichards Nov 5, 2024
e9aa0a9
handle the piece not being tracked in workflow in `SuggestAlternateCr…
twrichards Nov 5, 2024
5f128cf
poll for item counts in `FrontsIntegration` every 10 seconds
twrichards Nov 19, 2024
6d981f4
add loading message while loading the thumbs of relevant ratio (for t…
twrichards Nov 19, 2024
f9a33a6
clean up some imports
twrichards Nov 19, 2024
b4fb895
add telemetry events for `ALTERNATE_CROP_SUGGESTING_FEATURE_TURNED_ON…
twrichards Nov 21, 2024
e792227
handle errors in new crop suggestion & fronts integration
twrichards Nov 21, 2024
f74e79f
add optional `maybeAspectRatioFilter` arg to `listItems` Query so the…
twrichards Nov 23, 2024
50a0acc
fix anti-pattern of using array index (only) for react `key` prop
twrichards Nov 25, 2024
d2c9e8d
correct the signature of `getPinboardsByPaths`
twrichards Nov 25, 2024
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
48 changes: 48 additions & 0 deletions bootstrapping-lambda/local/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<meta charset="UTF-8" />
<title>PinBoard</title>
<script src="https://pinboard.local.dev-gutools.co.uk/pinboard.loader.js"></script>
<style>
body {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 100vh;
column-gap: 10px;
}
h3,
h4 {
margin-top: 10px;
margin-bottom: 5px;
}
</style>
</head>

<body>
Expand Down Expand Up @@ -56,6 +70,40 @@ <h3>Override unread notifications bubble</h3>
<button id="btn-unset-unread-notifications-bubble">Unset</button>
</div>

<h3>Fronts Integration</h3>

<h4>Composer Buttons etc. (under trail image in furniture)</h4>
<em>Requires preselected pinboard (like in composer)</em>
<div
style="background: #f6f6f6; padding-left: 420px; display: inline-block"
>
<div style="width: 195px">
<pinboard-suggest-alternate-crops
data-media-id="d6518ba44eb272830b779e4ed6356482007d4536"
></pinboard-suggest-alternate-crops>
</div>
</div>

<div style="max-width: 180px">
<h4>Fronts Clipboard Card:</h4>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
></pinboard-article-button>
</div>
<h4>Fronts Article Cards [Collapsed]:</h4>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
></pinboard-article-button>
<br />
<h4>Fronts Article Cards [Expanded]</h4>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
data-with-draggable-thumbs-of-ratio="5:4"
></pinboard-article-button>
<pinboard-article-button
data-url-path="uk-news/2024/oct/21/whats-my-scene-by-the-hoodoo-gurus-"
data-with-draggable-thumbs-of-ratio="4:5"
></pinboard-article-button>
<h3><code>Add to 📌</code> button</h3>
<ul id="button_section">
<h4>present initially</h4>
Expand Down
72 changes: 49 additions & 23 deletions cdk/lib/__snapshots__/stack.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2449,7 +2449,7 @@ Object {

type Query {
# database-bridge-lambda queries
listItems(pinboardId: String!): [Item]
listItems(pinboardId: String!, maybeAspectRatioFilter: String): [Item]
listLastItemSeenByUsers(pinboardId: String!): [LastItemSeenByUser]
getMyUser: MyUser
searchMentionableUsers(prefix: String!): UsersAndGroups
Expand All @@ -2459,6 +2459,7 @@ type Query {
# workflow-bridge-lambda queries
listPinboards(searchText: String): [WorkflowStub]
getPinboardsByIds(ids: [String!]!): [WorkflowStub]
getPinboardsByPaths(paths: [String!]!): [WorkflowStub]
getPinboardByComposerId(composerId: String!): WorkflowStub
# grid-bridge-lambda queries
getGridSearchSummary(apiUrl: String!): GridSearchSummary
Expand Down Expand Up @@ -2563,6 +2564,7 @@ type WorkflowStub {
title: String
headline: String
composerId: String
path: String
status: String
trashed: Boolean
isNotFound: Boolean
Expand Down Expand Up @@ -2628,6 +2630,9 @@ type PinboardIdWithItemCounts {
pinboardId: String!
unreadCount: Int!
totalCount: Int!
totalCropCount: Int!
fiveByFourCount: Int!
fourByFiveCount: Int!
}
",
},
Expand Down Expand Up @@ -2675,7 +2680,7 @@ type PinboardIdWithItemCounts {
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "addManuallyOpenedPinboardIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2696,7 +2701,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "changeFeatureFlag",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2717,7 +2722,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "claimItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2738,7 +2743,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "createItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2759,7 +2764,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "deleteItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2780,7 +2785,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "editItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2801,7 +2806,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "removeManuallyOpenedPinboardIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2822,7 +2827,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "seenItem",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2843,7 +2848,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "setWebPushSubscriptionForUser",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2864,7 +2869,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "visitTourStep",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Mutation",
},
Expand All @@ -2885,7 +2890,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getGroupPinboardIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2906,7 +2911,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getItemCounts",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2927,7 +2932,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getMyUser",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2948,7 +2953,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "getUsers",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2969,7 +2974,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "listItems",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -2990,7 +2995,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "listLastItemSeenByUsers",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3011,7 +3016,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "database_bridge_lambda_ds",
"FieldName": "searchMentionableUsers",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand Down Expand Up @@ -3140,7 +3145,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "grid_bridge_lambda_ds",
"FieldName": "asGridPayload",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3161,7 +3166,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "grid_bridge_lambda_ds",
"FieldName": "getGridSearchSummary",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand Down Expand Up @@ -3290,7 +3295,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "getPinboardByComposerId",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3311,7 +3316,28 @@ $util.toJson($ctx.result)",
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "getPinboardsByIds",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
"Type": "AWS::AppSync::Resolver",
},
"pinboardappsyncapiworkflowbridgelambdadsQuerygetPinboardsByPathsResolver98DFC3B6": Object {
"DependsOn": Array [
"pinboardappsyncapiSchema868D9F5B",
"pinboardappsyncapiworkflowbridgelambdadsD8193E3E",
],
"Properties": Object {
"ApiId": Object {
"Fn::GetAtt": Array [
"pinboardappsyncapi9D519400",
"ApiId",
],
},
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "getPinboardsByPaths",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand All @@ -3332,7 +3358,7 @@ $util.toJson($ctx.result)",
"DataSourceName": "workflow_bridge_lambda_ds",
"FieldName": "listPinboards",
"Kind": "UNIT",
"ResponseMappingTemplate": "## schema checksum : 117bac3c96ba985bef3ad1486ee0eb07
"ResponseMappingTemplate": "## schema checksum : da5ab4d1435d8fb629c068ee4933d29c
$util.toJson($ctx.result)",
"TypeName": "Query",
},
Expand Down
15 changes: 12 additions & 3 deletions client/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const pinboardReturnFields = `
headline
trashed
isNotFound
path
`;
export const gqlListPinboards = gql`
query MyQuery($searchText: String!) {
Expand All @@ -24,6 +25,11 @@ export const gqlGetPinboardsByIds = gql`
getPinboardsByIds(ids: $ids) { ${pinboardReturnFields} }
}
`;
export const gqlGetPinboardsByPaths = gql`
query MyQuery($paths: [String!]!) {
getPinboardsByPaths(paths: $paths) { ${pinboardReturnFields} }
}
`;
export const gqlGetGroupPinboardIds = gql`
query MyQuery {
getGroupPinboardIds {
Expand All @@ -43,6 +49,9 @@ export const gqlGetItemCounts = gql`
pinboardId
totalCount
unreadCount
totalCropCount
fiveByFourCount
fourByFiveCount
}
}
`;
Expand Down Expand Up @@ -71,9 +80,9 @@ const itemReturnFields = `
`;

// TODO: consider updating the resolver (cdk/stack.ts) to use a Query with a secondary index (if performance degrades when we have lots of items)
export const gqlGetInitialItems = (pinboardId: string) => gql`
query MyQuery {
listItems(pinboardId: "${pinboardId}") {
export const gqlGetInitialItems = gql`
query MyQuery($pinboardId: String!, $maybeAspectRatioFilter: String) {
listItems(pinboardId: $pinboardId, maybeAspectRatioFilter: $maybeAspectRatioFilter) {
${itemReturnFields}
}
}
Expand Down
Loading