90 | );
91 | }
92 |
93 | export default Login
94 |
--------------------------------------------------------------------------------
/.github/workflows/google.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a docker container, publish it to Google Container Registry, and deploy it to GKE when there is a push to the master branch.
2 | #
3 | # To configure this workflow:
4 | #
5 | # 1. Ensure that your repository contains the necessary configuration for your Google Kubernetes Engine cluster, including deployment.yml, kustomization.yml, service.yml, etc.
6 | #
7 | # 2. Set up secrets in your workspace: GKE_PROJECT with the name of the project and GKE_SA_KEY with the Base64 encoded JSON service account key (https://github.com/GoogleCloudPlatform/github-actions/tree/docs/service-account-key/setup-gcloud#inputs).
8 | #
9 | # 3. Change the values for the GKE_ZONE, GKE_CLUSTER, IMAGE, and DEPLOYMENT_NAME environment variables (below).
10 | #
11 | # For more support on how to run the workflow, please visit https://github.com/google-github-actions/setup-gcloud/tree/master/example-workflows/gke
12 |
13 | name: Build and Deploy to GKE
14 |
15 | on:
16 | push:
17 | branches:
18 | - master
19 |
20 | env:
21 | PROJECT_ID: ${{ secrets.GKE_PROJECT }}
22 | GKE_CLUSTER: cluster-1 # TODO: update to cluster name
23 | GKE_ZONE: us-central1-c # TODO: update to cluster zone
24 | DEPLOYMENT_NAME: gke-test # TODO: update to deployment name
25 | IMAGE: static-site
26 |
27 | jobs:
28 | setup-build-publish-deploy:
29 | name: Setup, Build, Publish, and Deploy
30 | runs-on: ubuntu-latest
31 | environment: production
32 |
33 | steps:
34 | - name: Checkout
35 | uses: actions/checkout@v2
36 |
37 | # Setup gcloud CLI
38 | - uses: google-github-actions/setup-gcloud@v0.2.0
39 | with:
40 | service_account_key: ${{ secrets.GKE_SA_KEY }}
41 | project_id: ${{ secrets.GKE_PROJECT }}
42 |
43 | # Configure Docker to use the gcloud command-line tool as a credential
44 | # helper for authentication
45 | - run: |-
46 | gcloud --quiet auth configure-docker
47 |
48 | # Get the GKE credentials so we can deploy to the cluster
49 | - uses: google-github-actions/get-gke-credentials@v0.2.1
50 | with:
51 | cluster_name: ${{ env.GKE_CLUSTER }}
52 | location: ${{ env.GKE_ZONE }}
53 | credentials: ${{ secrets.GKE_SA_KEY }}
54 |
55 | # Build the Docker image
56 | - name: Build
57 | run: |-
58 | docker build \
59 | --tag "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA" \
60 | --build-arg GITHUB_SHA="$GITHUB_SHA" \
61 | --build-arg GITHUB_REF="$GITHUB_REF" \
62 | .
63 |
64 | # Push the Docker image to Google Container Registry
65 | - name: Publish
66 | run: |-
67 | docker push "gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA"
68 |
69 | # Set up kustomize
70 | - name: Set up Kustomize
71 | run: |-
72 | curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
73 | chmod u+x ./kustomize
74 |
75 | # Deploy the Docker image to the GKE cluster
76 | - name: Deploy
77 | run: |-
78 | ./kustomize edit set image gcr.io/PROJECT_ID/IMAGE:TAG=gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA
79 | ./kustomize build . | kubectl apply -f -
80 | kubectl rollout status deployment/$DEPLOYMENT_NAME
81 | kubectl get services -o wide
82 |
--------------------------------------------------------------------------------
/.eslintcache:
--------------------------------------------------------------------------------
1 | [{"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/serviceWorker.js":"1","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/App.js":"2","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Header/Header.js":"3","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Header/HeaderOption.js":"4","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/app/store.js":"5","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Sidebar/Sidebar.js":"6","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Feed/Feed.js":"7","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Feed/InputOption.js":"8","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/index.js":"9","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Post/Post.js":"10","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/firebase.js":"11","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/features/userSlice.js":"12","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Login/Login.js":"13","/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Widget/Widgets.js":"14"},{"size":5141,"mtime":1609512073771,"results":"15","hashOfConfig":"16"},{"size":1291,"mtime":1609608464040,"results":"17","hashOfConfig":"16"},{"size":1563,"mtime":1609605044295,"results":"18","hashOfConfig":"16"},{"size":646,"mtime":1609605246525,"results":"19","hashOfConfig":"16"},{"size":186,"mtime":1609593687908,"results":"20","hashOfConfig":"16"},{"size":1519,"mtime":1609620460776,"results":"21","hashOfConfig":"16"},{"size":2433,"mtime":1609607344300,"results":"22","hashOfConfig":"16"},{"size":242,"mtime":1609569396906,"results":"23","hashOfConfig":"16"},{"size":644,"mtime":1609512073771,"results":"24","hashOfConfig":"16"},{"size":1251,"mtime":1609620915932,"results":"25","hashOfConfig":"16"},{"size":530,"mtime":1609586978067,"results":"26","hashOfConfig":"16"},{"size":706,"mtime":1609593580785,"results":"27","hashOfConfig":"16"},{"size":2551,"mtime":1609602939630,"results":"28","hashOfConfig":"16"},{"size":836,"mtime":1609610247636,"results":"29","hashOfConfig":"16"},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},"15i2twh",{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"43","messages":"44","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"47","messages":"48","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"49","messages":"50","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"51","messages":"52","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"53","messages":"54","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"55","messages":"56","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"57","messages":"58","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/serviceWorker.js",[],["59","60"],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/App.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Header/Header.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Header/HeaderOption.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/app/store.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Sidebar/Sidebar.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Feed/Feed.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Feed/InputOption.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/index.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Post/Post.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/firebase.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/features/userSlice.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Login/Login.js",[],"/home/jsloyalty/Desktop/Redux/linkedin-clone/src/components/Body/Widget/Widgets.js",[],{"ruleId":"61","replacedBy":"62"},{"ruleId":"63","replacedBy":"64"},"no-native-reassign",["65"],"no-negated-in-lhs",["66"],"no-global-assign","no-unsafe-negation"]
--------------------------------------------------------------------------------
/src/serviceWorker.js:
--------------------------------------------------------------------------------
1 | // This optional code is used to register a service worker.
2 | // register() is not called by default.
3 |
4 | // This lets the app load faster on subsequent visits in production, and gives
5 | // it offline capabilities. However, it also means that developers (and users)
6 | // will only see deployed updates on subsequent visits to a page, after all the
7 | // existing tabs open on the page have been closed, since previously cached
8 | // resources are updated in the background.
9 |
10 | // To learn more about the benefits of this model and instructions on how to
11 | // opt-in, read https://bit.ly/CRA-PWA
12 |
13 | const isLocalhost = Boolean(
14 | window.location.hostname === 'localhost' ||
15 | // [::1] is the IPv6 localhost address.
16 | window.location.hostname === '[::1]' ||
17 | // 127.0.0.0/8 are considered localhost for IPv4.
18 | window.location.hostname.match(
19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
20 | )
21 | );
22 |
23 | export function register(config) {
24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
25 | // The URL constructor is available in all browsers that support SW.
26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
27 | if (publicUrl.origin !== window.location.origin) {
28 | // Our service worker won't work if PUBLIC_URL is on a different origin
29 | // from what our page is served on. This might happen if a CDN is used to
30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374
31 | return;
32 | }
33 |
34 | window.addEventListener('load', () => {
35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
36 |
37 | if (isLocalhost) {
38 | // This is running on localhost. Let's check if a service worker still exists or not.
39 | checkValidServiceWorker(swUrl, config);
40 |
41 | // Add some additional logging to localhost, pointing developers to the
42 | // service worker/PWA documentation.
43 | navigator.serviceWorker.ready.then(() => {
44 | console.log(
45 | 'This web app is being served cache-first by a service ' +
46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA'
47 | );
48 | });
49 | } else {
50 | // Is not localhost. Just register service worker
51 | registerValidSW(swUrl, config);
52 | }
53 | });
54 | }
55 | }
56 |
57 | function registerValidSW(swUrl, config) {
58 | navigator.serviceWorker
59 | .register(swUrl)
60 | .then(registration => {
61 | registration.onupdatefound = () => {
62 | const installingWorker = registration.installing;
63 | if (installingWorker == null) {
64 | return;
65 | }
66 | installingWorker.onstatechange = () => {
67 | if (installingWorker.state === 'installed') {
68 | if (navigator.serviceWorker.controller) {
69 | // At this point, the updated precached content has been fetched,
70 | // but the previous service worker will still serve the older
71 | // content until all client tabs are closed.
72 | console.log(
73 | 'New content is available and will be used when all ' +
74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
75 | );
76 |
77 | // Execute callback
78 | if (config && config.onUpdate) {
79 | config.onUpdate(registration);
80 | }
81 | } else {
82 | // At this point, everything has been precached.
83 | // It's the perfect time to display a
84 | // "Content is cached for offline use." message.
85 | console.log('Content is cached for offline use.');
86 |
87 | // Execute callback
88 | if (config && config.onSuccess) {
89 | config.onSuccess(registration);
90 | }
91 | }
92 | }
93 | };
94 | };
95 | })
96 | .catch(error => {
97 | console.error('Error during service worker registration:', error);
98 | });
99 | }
100 |
101 | function checkValidServiceWorker(swUrl, config) {
102 | // Check if the service worker can be found. If it can't reload the page.
103 | fetch(swUrl, {
104 | headers: { 'Service-Worker': 'script' },
105 | })
106 | .then(response => {
107 | // Ensure service worker exists, and that we really are getting a JS file.
108 | const contentType = response.headers.get('content-type');
109 | if (
110 | response.status === 404 ||
111 | (contentType != null && contentType.indexOf('javascript') === -1)
112 | ) {
113 | // No service worker found. Probably a different app. Reload the page.
114 | navigator.serviceWorker.ready.then(registration => {
115 | registration.unregister().then(() => {
116 | window.location.reload();
117 | });
118 | });
119 | } else {
120 | // Service worker found. Proceed as normal.
121 | registerValidSW(swUrl, config);
122 | }
123 | })
124 | .catch(() => {
125 | console.log(
126 | 'No internet connection found. App is running in offline mode.'
127 | );
128 | });
129 | }
130 |
131 | export function unregister() {
132 | if ('serviceWorker' in navigator) {
133 | navigator.serviceWorker.ready.then(registration => {
134 | registration.unregister();
135 | });
136 | }
137 | }
138 |
--------------------------------------------------------------------------------