Skip to content

Commit ca73494

Browse files
authored
Merge pull request #43 from oslabs-beta/liam/screenshots
Liam/screenshots
2 parents 450b76a + adcd0e5 commit ca73494

File tree

19 files changed

+22981
-13140
lines changed

19 files changed

+22981
-13140
lines changed

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,3 +501,27 @@ server/RootCA.srl
501501
/test-results/
502502
/playwright-report/
503503
/playwright/.cache/
504+
505+
#amplify-do-not-edit-begin
506+
amplify/\#current-cloud-backend
507+
amplify/.config/local-*
508+
amplify/logs
509+
amplify/mock-data
510+
amplify/mock-api-resources
511+
amplify/backend/amplify-meta.json
512+
amplify/backend/.temp
513+
build/
514+
dist/
515+
node_modules/
516+
aws-exports.js
517+
awsconfiguration.json
518+
amplifyconfiguration.json
519+
amplifyconfiguration.dart
520+
amplify-build-config.json
521+
amplify-gradle-config.json
522+
amplifytools.xcconfig
523+
.secret-*
524+
**.sample
525+
#amplify-do-not-edit-end
526+
527+
team-provider-info.json

amplify/.config/project-config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"projectName": "ReacType",
3+
"version": "3.1",
4+
"frontend": "javascript",
5+
"javascript": {
6+
"framework": "none",
7+
"config": {
8+
"SourceDir": "src",
9+
"DistributionDir": "dist",
10+
"BuildCommand": "npm run-script build",
11+
"StartCommand": "npm run-script start"
12+
}
13+
},
14+
"providers": [
15+
"awscloudformation"
16+
]
17+
}

amplify/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Getting Started with Amplify CLI
2+
This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli).
3+
4+
Helpful resources:
5+
- Amplify documentation: https://docs.amplify.aws
6+
- Amplify CLI documentation: https://docs.amplify.aws/cli
7+
- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files
8+
- Join Amplify's community: https://amplify.aws/community/
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"version": "1",
3+
"cognitoConfig": {
4+
"identityPoolName": "reactype24e8d371_identitypool_24e8d371",
5+
"allowUnauthenticatedIdentities": true,
6+
"resourceNameTruncated": "reacty24e8d371",
7+
"userPoolName": "reactype24e8d371_userpool_24e8d371",
8+
"autoVerifiedAttributes": [
9+
"email"
10+
],
11+
"mfaConfiguration": "OFF",
12+
"mfaTypes": [
13+
"SMS Text Message"
14+
],
15+
"smsAuthenticationMessage": "Your authentication code is {####}",
16+
"smsVerificationMessage": "Your verification code is {####}",
17+
"emailVerificationSubject": "Your verification code",
18+
"emailVerificationMessage": "Your verification code is {####}",
19+
"defaultPasswordPolicy": false,
20+
"passwordPolicyMinLength": 8,
21+
"passwordPolicyCharacters": [],
22+
"requiredAttributes": [
23+
"email"
24+
],
25+
"aliasAttributes": [],
26+
"userpoolClientGenerateSecret": false,
27+
"userpoolClientRefreshTokenValidity": 30,
28+
"userpoolClientWriteAttributes": [
29+
"email"
30+
],
31+
"userpoolClientReadAttributes": [
32+
"email"
33+
],
34+
"userpoolClientLambdaRole": "reacty24e8d371_userpoolclient_lambda_role",
35+
"userpoolClientSetAttributes": false,
36+
"sharedId": "24e8d371",
37+
"resourceName": "reactype24e8d371",
38+
"authSelections": "identityPoolAndUserPool",
39+
"useDefault": "default",
40+
"userPoolGroupList": [],
41+
"serviceName": "Cognito",
42+
"usernameCaseSensitive": false,
43+
"useEnabledMfas": true,
44+
"authRoleArn": {
45+
"Fn::GetAtt": [
46+
"AuthRole",
47+
"Arn"
48+
]
49+
},
50+
"unauthRoleArn": {
51+
"Fn::GetAtt": [
52+
"UnauthRole",
53+
"Arn"
54+
]
55+
},
56+
"breakCircularDependency": true,
57+
"dependsOn": []
58+
}
59+
}

amplify/backend/backend-config.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"auth": {
3+
"reactype24e8d371": {
4+
"customAuth": false,
5+
"dependsOn": [],
6+
"frontendAuthConfig": {
7+
"mfaConfiguration": "OFF",
8+
"mfaTypes": [
9+
"SMS"
10+
],
11+
"passwordProtectionSettings": {
12+
"passwordPolicyCharacters": [],
13+
"passwordPolicyMinLength": 8
14+
},
15+
"signupAttributes": [
16+
"EMAIL"
17+
],
18+
"socialProviders": [],
19+
"usernameAttributes": [],
20+
"verificationMechanisms": [
21+
"EMAIL"
22+
]
23+
},
24+
"providerPlugin": "awscloudformation",
25+
"service": "Cognito"
26+
}
27+
},
28+
"storage": {
29+
"ReacTypeMktImg": {
30+
"dependsOn": [],
31+
"providerPlugin": "awscloudformation",
32+
"service": "S3"
33+
}
34+
}
35+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"resourceName": "ReacTypeMktImg",
3+
"policyUUID": "f87a3e6a",
4+
"bucketName": "reactypemktimgs",
5+
"storageAccess": "authAndGuest",
6+
"guestAccess": [
7+
"READ"
8+
],
9+
"authAccess": [
10+
"CREATE_AND_UPDATE",
11+
"READ",
12+
"DELETE"
13+
],
14+
"triggerFunction": "NONE",
15+
"groupAccess": {}
16+
}

amplify/backend/tags.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"Key": "user:Stack",
4+
"Value": "{project-env}"
5+
},
6+
{
7+
"Key": "user:Application",
8+
"Value": "{project-name}"
9+
}
10+
]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export type AmplifyDependentResourcesAttributes = {
2+
"auth": {
3+
"reactype24e8d371": {
4+
"AppClientID": "string",
5+
"AppClientIDWeb": "string",
6+
"IdentityPoolId": "string",
7+
"IdentityPoolName": "string",
8+
"UserPoolArn": "string",
9+
"UserPoolId": "string",
10+
"UserPoolName": "string"
11+
}
12+
},
13+
"storage": {
14+
"ReacTypeMktImg": {
15+
"BucketName": "string",
16+
"Region": "string"
17+
}
18+
}
19+
}

amplify/cli.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"features": {
3+
"graphqltransformer": {
4+
"addmissingownerfields": true,
5+
"improvepluralization": false,
6+
"validatetypenamereservedwords": true,
7+
"useexperimentalpipelinedtransformer": true,
8+
"enableiterativegsiupdates": true,
9+
"secondarykeyasgsi": true,
10+
"skipoverridemutationinputtypes": true,
11+
"transformerversion": 2,
12+
"suppressschemamigrationprompt": true,
13+
"securityenhancementnotification": false,
14+
"showfieldauthnotification": false,
15+
"usesubusernamefordefaultidentityclaim": true,
16+
"usefieldnameforprimarykeyconnectionfield": false,
17+
"enableautoindexquerynames": true,
18+
"respectprimarykeyattributesonconnectionfield": true,
19+
"shoulddeepmergedirectiveconfigdefaults": false,
20+
"populateownerfieldforstaticgroupauth": true
21+
},
22+
"frontend-ios": {
23+
"enablexcodeintegration": true
24+
},
25+
"auth": {
26+
"enablecaseinsensitivity": true,
27+
"useinclusiveterminology": true,
28+
"breakcirculardependency": true,
29+
"forcealiasattributes": false,
30+
"useenabledmfas": true
31+
},
32+
"codegen": {
33+
"useappsyncmodelgenplugin": true,
34+
"usedocsgeneratorplugin": true,
35+
"usetypesgeneratorplugin": true,
36+
"cleangeneratedmodelsdirectory": true,
37+
"retaincasestyle": true,
38+
"addtimestampfields": true,
39+
"handlelistnullabilitytransparently": true,
40+
"emitauthprovider": true,
41+
"generateindexrules": true,
42+
"enabledartnullsafety": true,
43+
"generatemodelsforlazyloadandcustomselectionset": false
44+
},
45+
"appsync": {
46+
"generategraphqlpermissions": true
47+
},
48+
"latestregionsupport": {
49+
"pinpoint": 1,
50+
"translate": 1,
51+
"transcribe": 1,
52+
"rekognition": 1,
53+
"textract": 1,
54+
"comprehend": 1
55+
},
56+
"project": {
57+
"overrides": true
58+
}
59+
},
60+
"debug": {
61+
"shareProjectConfig": false
62+
}
63+
}

amplify/hooks/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Command Hooks
2+
3+
Command hooks can be used to run custom scripts upon Amplify CLI lifecycle events like pre-push, post-add-function, etc.
4+
5+
To get started, add your script files based on the expected naming convention in this directory.
6+
7+
Learn more about the script file naming convention, hook parameters, third party dependencies, and advanced configurations at https://docs.amplify.aws/cli/usage/command-hooks

app/src/components/marketplace/MarketplaceCard.tsx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ import {
1919
resetAllState
2020
} from '../../redux/reducers/slice/appStateSlice';
2121
import { useDispatch, useSelector } from 'react-redux';
22-
2322
import { MoreVert } from '@mui/icons-material';
2423
import { RootState } from '../../redux/store';
2524
import Snackbar from '@mui/material/Snackbar';
2625
import axios from 'axios';
27-
import imageSrc from '../../../../resources/marketplace_images/marketplace_image.png';
26+
// import imageSrc from '../../../../resources/marketplace_images/marketplace_image.png';
2827
import { red } from '@mui/material/colors';
2928
import { saveProject } from '../../helperFunctions/projectGetSaveDel';
3029
import { useHistory } from 'react-router-dom';
30+
import { Amplify, Storage } from 'aws-amplify';
31+
import awsconfig from '../../../../src/aws-exports';
3132

3233
interface Project {
3334
forked: String;
@@ -47,9 +48,27 @@ const MarketplaceCard = ({ proj }: { proj: Project }) => {
4748
const dispatch = useDispatch();
4849
const history = useHistory();
4950
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
51+
const [s3ImgURL, setS3ImgURL] = React.useState<null | string>(null);
5052
const open = Boolean(anchorEl);
5153
const [alertOpen, setAlertOpen] = React.useState<boolean>(false);
52-
const state = useSelector((store: RootState) => store.appState);
54+
55+
useEffect(() => {
56+
async function s3ImgFetch() {
57+
Amplify.configure(awsconfig);
58+
try {
59+
const objId: string = proj._id.toString();
60+
// the below functions are commented out as not to incur too many charges
61+
// const response: string = await Storage.get(objId);
62+
// const response: string = await Storage.get('test');
63+
// setS3ImgURL(response);
64+
} catch (error) {
65+
console.error(`Error fetching image preview for ${proj._id}: `, error);
66+
}
67+
}
68+
s3ImgFetch();
69+
}, []);
70+
71+
5372
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
5473
setAnchorEl(event.currentTarget);
5574
};
@@ -107,8 +126,8 @@ const MarketplaceCard = ({ proj }: { proj: Project }) => {
107126
sx={{ borderRadius: '12px', height: 200 }}
108127
component="img"
109128
height="194"
110-
image={imageSrc}
111-
alt="component buttons"
129+
image={s3ImgURL}
130+
alt="component preview"
112131
/>
113132
<CardHeader
114133
avatar={

app/src/components/top/NavBar.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import logo from '../../public/icons/win/logo.png';
1010
import { useSelector, useDispatch } from 'react-redux';
1111
import { publishProject, unpublishProject } from '../../helperFunctions/projectGetSaveDel';
1212
import PublishModal from './PublishModal';
13-
import { updateProjectId, updateProjectName, updateProjectPublished } from '../../redux/reducers/slice/appStateSlice';
13+
import { updateProjectId, updateProjectName, updateProjectPublished, toggleScreenshotTrigger } from '../../redux/reducers/slice/appStateSlice';
1414
import { State } from '../../interfaces/Interfaces';
1515
import MuiAlert, { AlertProps } from '@mui/material/Alert';
1616
import Snackbar from '@mui/material/Snackbar';
@@ -94,9 +94,10 @@ const NavBar = () => {
9494
.then((newProject: State) => {
9595
console.log('Project published successfully', newProject);
9696
setPublishModalOpen(false);
97-
dispatch(updateProjectId(newProject._id))
98-
dispatch(updateProjectName(newProject.name))
99-
dispatch(updateProjectPublished(newProject.published))
97+
dispatch(updateProjectId(newProject._id));
98+
dispatch(updateProjectName(newProject.name));
99+
dispatch(updateProjectPublished(newProject.published));
100+
dispatch(toggleScreenshotTrigger());
100101
setAlertOpen(true)
101102
})
102103
.catch((error) => {

0 commit comments

Comments
 (0)