Skip to content

Commit

Permalink
fix: remove card
Browse files Browse the repository at this point in the history
  • Loading branch information
tejaskh3 committed Oct 11, 2024
1 parent bfd83a2 commit 9697eb6
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 68 deletions.
106 changes: 103 additions & 3 deletions app/controllers/subscribe.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,103 @@
// import Controller from '@ember/controller';
// import { tracked } from '@glimmer/tracking';
// import { action } from '@ember/object';
// import { inject as service } from '@ember/service';
// import { RDS_TWITTER, APPS } from '../constants/urls';
// import { TOAST_OPTIONS } from '../constants/toast-options';

// export default class SubscribeController extends Controller {
// @service login;
// @tracked isFormOpen = false;
// @tracked email = '';
// @tracked phone = '';
// @tracked userData = null;
// @tracked isLoading = false;
// @tracked showSubscriptionConfirmation = false;

// RDS_TWITTER = RDS_TWITTER;

// constructor() {
// super(...arguments);
// this.userData = this.login.userData;
// }

// get isLoggedIn() {
// return this.login.isLoggedIn;
// }

// get isSubscribed() {
// return this.login.userData.isSubscribed;
// }

// get isSubmitDisabled() {
// return !this.email || (this.phone && !/^\+?\d*$/.test(this.phone));
// }

// @action
// toggleFormModal() {
// this.isFormOpen = !this.isFormOpen;
// }

// @action
// updateEmail(event) {
// this.email = event.target.value;
// }

// @action
// updatePhone(event) {
// const input = event.target.value;
// const isValidPhone = /^\+?\d*$/.test(input);
// if (isValidPhone) {
// this.phone = input;
// }
// }

// @action
// async handleSubmit(event) {
// event.preventDefault();
// if (!this.isSubmitDisabled) {
// this.isLoading = true;
// try {
// const url = `${APPS.API_BACKEND}/subscription?dev=true`;
// const response = await fetch(url, {
// method: 'POST',
// body: JSON.stringify({
// email: this.email,
// phoneNumber: this.phone,
// }),
// headers: {
// 'Content-Type': 'application/json',
// },
// credentials: 'include',
// });
// if (!response.ok) {
// this.toast.error(
// 'Something went wrong. Please try again.',
// '',
// TOAST_OPTIONS,
// );
// } else {
// this.login.userData.isSubscribed = true;
// this.isFormOpen = false;
// this.showSubscriptionConfirmation = true;
// this.toast.info('🎉 Thank you for subscribing!', '', TOAST_OPTIONS);
// }
// } catch (error) {
// console.log(error);
// this.toast.error(
// `Something went wrong. ${error.message}`,
// '',
// TOAST_OPTIONS,
// );
// } finally {
// this.isLoading = false;
// }
// this.email = '';
// this.phone = '';
// }
// }
// }

import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
Expand All @@ -12,7 +112,7 @@ export default class SubscribeController extends Controller {
@tracked phone = '';
@tracked userData = null;
@tracked isLoading = false;
@tracked showSubscriptionConfirmation = false;
@tracked showSubscribedMessage = false;
RDS_TWITTER = RDS_TWITTER;
Expand Down Expand Up @@ -79,8 +179,8 @@ export default class SubscribeController extends Controller {
} else {
this.login.userData.isSubscribed = true;
this.isFormOpen = false;
this.showSubscriptionConfirmation = true;
this.toast.info('🎉 Thank you for subscribing!', '', TOAST_OPTIONS);
this.showSubscribedMessage = true;
this.toast.info('🎉 You are already subscribed!', '', TOAST_OPTIONS);
}
} catch (error) {
console.log(error);
Expand Down
64 changes: 0 additions & 64 deletions app/styles/subscribe.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -176,54 +176,6 @@
background-color: #dadada;
}

.subscribed__confirmed {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: white;
max-width: 30rem;
max-height: 16rem;
height: 25rem;
padding: 1.5rem;
gap: 0.625rem;
position: relative;
font-family: Inter, sans-serif;
border: 0.0625rem solid var(--gray-200, #e5e7eb);
border-radius: 0.375rem;
box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 10%);
margin-top: 9rem;
}

.subscribed__confirmed h1 {
font-weight: 600;
line-height: 30px;
text-align: center;
color: #1e429f;
}

.subscribed__confirmed p {
font-size: 15px;
font-weight: 500;
line-height: 22.5px;
text-align: center;
color: #565960;
}

.subscribed__confirmed nav {
width: 80%;
text-align: center;
transition: background-color 0.3s;
}

.subscribed__confirmed nav:hover {
background-color: #163a7b;
}

.subscribed__confirmed nav a:hover {
background-color: #163a7b;
}

.login__message {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -279,19 +231,3 @@
color: #374151;
text-align: center;
}

.discord-link {
display: inline-block;
font-size: 16px;
font-weight: 600;
color: white;
background-color: #1e429f;
padding: 12px 24px;
border-radius: 8px;
text-decoration: none;
transition: background-color 0.3s ease;
}

.discord-link:hover {
background-color: #1558b0;
}
54 changes: 53 additions & 1 deletion app/templates/subscribe.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{page-title 'Subscribe'}}
{{!-- {{page-title 'Subscribe'}}
<div class='subscribe__container'>
{{#if this.isLoggedIn}}
Expand Down Expand Up @@ -56,4 +56,56 @@
<p>Please connect with GitHub to subscribe for notifications.</p>
</div>
{{/if}}
</div> --}}


{{page-title 'Subscribe'}}

<div class='subscribe__container'>
{{#if this.isLoggedIn}}
{{#if (or this.isSubscribed this.showSubscribedMessage)}}
<div class="already-subscribed">
<h1>🎉 You're Already Subscribed!</h1>
<p>Thanks for your interest! You're all set to receive notifications when new applications open.</p>
</div>
{{else}}
{{#if this.isFormOpen}}
<div class="subscribe__form_container">
<h1>Subscribe to Notifications</h1>
<p>Get notified as soon as new applications open and never miss an update!</p>
<div class="subscribe__form">
<form {{on "submit" this.handleSubmit}}>
<div class="input__group">
<label for="email">Email Address</label>
<input type="email" id="email" placeholder="eg: Realdev@gmail.com" required value={{this.email}} {{on "input" this.updateEmail}} />
</div>

<div class="input__group">
<label for="phone">Phone Number <span class="input__group__span">(Optional)</span></label>
<input
type="text"
id="phone"
value={{this.phone}}
{{on "input" this.updatePhone}}
placeholder="eg: +91 1234567890"
>
</div>

<button class="notify__btn subscribe__button" disabled={{this.isSubmitDisabled}} type="submit">{{#if this.isLoading}} Subscribing... {{else}} Subscribe {{/if}}</button>
</form>
</div>
</div>
{{else}}
<h1>Join the Real Dev Squad Community</h1>
<p class="notification__text">We're currently not accepting new applications. Please check back in 2024.</p>
<p class="sub__text">Be the first to know when applications open!</p>
<button class="notify__btn" type="button" {{on "click" this.toggleFormModal}}>Notify Me When Applications Open</button>
{{/if}}
{{/if}}
{{else}}
<div class="login__message">
<h1>GitHub Login Required</h1>
<p>Please connect with GitHub to subscribe for notifications.</p>
</div>
{{/if}}
</div>

0 comments on commit 9697eb6

Please sign in to comment.