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

Fix up transactional email look/feel #442

Merged
merged 2 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 8 additions & 3 deletions app/graphql/types/query_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def viewer

field :current_company, Types::StaffPlan::CompanyType, null: true, description: "The company in scope for all other company-related queries."
def current_company
context[:current_company]
Company.includes(:projects, users: :avatar_attachment).find(context[:current_company].id)
end

field :clients, [Types::StaffPlan::ClientType], null: false, description: "Fetches all clients for the current company."
Expand All @@ -35,7 +35,9 @@ def clients

field :projects, [Types::StaffPlan::ProjectType], null: false, description: "Fetches all projects for the current company."
def projects
context[:current_company].projects.all
context[:current_company]
.projects
.all
end

field :project_assignments, [Types::StaffPlan::AssignmentType], null: false, description: "Fetches all assignments for the company's projects."do
Expand Down Expand Up @@ -66,7 +68,10 @@ def user_assignments(user_id: nil)

field :users, [Types::StaffPlan::UserType], null: false, description: "Fetches all users for the current company."
def users
context[:current_user].current_company.users.all
context[:current_user]
.current_company
.users
.all
end
end
end
4 changes: 2 additions & 2 deletions app/graphql/types/staff_plan/user_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def companies
field :assignments, [Types::StaffPlan::AssignmentType], null: false, description: "Fetches all of the user's assignments for the current company."

def assignments
object.assignments.where(project_id: object.current_company.projects.map(&:id))
object.assignments.includes(:work_weeks, project: :client).where(project_id: object.current_company.projects.map(&:id))
end

field :projects, [Types::StaffPlan::ProjectType], null: false, description: "Fetches all projects for the current user for the current company."

def projects
object.projects.where(client_id: object.current_company.clients.map(&:id))
object.projects.includes(assignments: [:work_weeks, project: :client]).where(client_id: object.current_company.clients.map(&:id))
end

field :role, String, null: false, description: "The role of the user in the current_company"
Expand Down
55 changes: 47 additions & 8 deletions app/views/billing_mailer/subscription_updated.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
<h1><%= @greeting %></h1>

<p>
Your StaffPlan account is growing! We've updated your account based on the <%= pluralize(@new_subscription_count, 'user') %> in your account.
</p>
<p>
Happy Planning!
</p>
<body style="margin: 0; width: 100%; background-color: #f8fafc; padding: 0; -webkit-font-smoothing: antialiased; word-break: break-word">
<div role="article" aria-roledescription="email" aria-label lang="en">
<div class="sm-px-4" style="background-color: #f8fafc; font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif">
<table align="center" style="margin: 0 auto" cellpadding="0" cellspacing="0" role="none">
<tr>
<td style="width: 552px; max-width: 100%">
<div role="separator" style="line-height: 24px">&zwj;</div>
<table style="width: 100%" cellpadding="0" cellspacing="0" role="none">
<tr>
<td class="sm-p-6" style="border-radius: 8px; background-color: #fffffe; padding: 24px 36px; border: 1px solid #e2e8f0">
<a href="https://app.staffplan.com">
<img src="https://app.staffplan.com/assets/staffplan-logo-notext-568affe9b8becd2bc88fd2fed64d0c42075d02916b900ec4a04ac651b5788431.png" width="70" alt="StaffPlan" style="max-width: 100%; vertical-align: middle">
</a>
<div role="separator" style="line-height: 24px">&zwj;</div>
<h1 style="margin: 0 0 24px; font-size: 24px; line-height: 32px; font-weight: 600; color: #0f172a">
<%= @greeting %>
</h1>
<p style="margin: 0 0 24px; font-size: 16px; line-height: 24px; color: #475569">
Your StaffPlan account is growing! We've updated your account based on the <%= pluralize(@new_subscription_count, 'user') %> in your account.
</p>
<p style="margin: 0 0 24px; font-size: 16px; line-height: 24px; color: #475569">
Happy Planning!
</p>
<div role="separator" style="line-height: 24px">&zwj;</div>
<p style="margin: 0; font-size: 16px; line-height: 24px; color: #475569">
Thanks,
<br>
<span style="font-weight: 600">StaffPlan</span>
</p>
</td>
</tr>
</table>
<table style="width: 100%" cellpadding="0" cellspacing="0" role="none">
<tr>
<td class="sm-px-6" style="padding: 24px 36px">
<p style="margin: 0; font-size: 12px; color: #64748b">
&copy; <%= Date.today.year %> StaffPlan. All rights reserved.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</body>
55 changes: 47 additions & 8 deletions app/views/company_mailer/welcome.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
<h1><%= @greeting %></h1>

<p>
You can start using StaffPlan immediately by signing in <%= link_to "here", root_url %>.
</p>
<p>
Happy Planning!
</p>
<body style="margin: 0; width: 100%; background-color: #f8fafc; padding: 0; -webkit-font-smoothing: antialiased; word-break: break-word">
<div role="article" aria-roledescription="email" aria-label lang="en">
<div class="sm-px-4" style="background-color: #f8fafc; font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif">
<table align="center" style="margin: 0 auto" cellpadding="0" cellspacing="0" role="none">
<tr>
<td style="width: 552px; max-width: 100%">
<div role="separator" style="line-height: 24px">&zwj;</div>
<table style="width: 100%" cellpadding="0" cellspacing="0" role="none">
<tr>
<td class="sm-p-6" style="border-radius: 8px; background-color: #fffffe; padding: 24px 36px; border: 1px solid #e2e8f0">
<a href="https://app.staffplan.com">
<img src="https://app.staffplan.com/assets/staffplan-logo-notext-568affe9b8becd2bc88fd2fed64d0c42075d02916b900ec4a04ac651b5788431.png" width="70" alt="StaffPlan" style="max-width: 100%; vertical-align: middle">
</a>
<div role="separator" style="line-height: 24px">&zwj;</div>
<h1 style="margin: 0 0 24px; font-size: 24px; line-height: 32px; font-weight: 600; color: #0f172a">
<%= @greeting %>
</h1>
<p style="margin: 0 0 24px; font-size: 16px; line-height: 24px; color: #475569">
You can start using StaffPlan immediately by signing in <%= link_to "here", root_url %>.
</p>
<p style="margin: 0 0 24px; font-size: 16px; line-height: 24px; color: #475569">
Happy Planning!
</p>
<div role="separator" style="line-height: 24px">&zwj;</div>
<p style="margin: 0; font-size: 16px; line-height: 24px; color: #475569">
Thanks,
<br>
<span style="font-weight: 600">StaffPlan</span>
</p>
</td>
</tr>
</table>
<table style="width: 100%" cellpadding="0" cellspacing="0" role="none">
<tr>
<td class="sm-px-6" style="padding: 24px 36px">
<p style="margin: 0; font-size: 12px; color: #64748b">
&copy; <%= Date.today.year %> StaffPlan. All rights reserved.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</body>
62 changes: 54 additions & 8 deletions app/views/registrations_mailer/create.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
<h1><%= @greeting %></h1>

<p>
Thanks for registering for StaffPlan. The next step is to <%= link_to 'confirm your email address', @magic_link %> by clicking the link below:
</p>
<p>
<%= link_to @magic_link, @magic_link %>
</p>
<body style="margin: 0; width: 100%; background-color: #f8fafc; padding: 0; -webkit-font-smoothing: antialiased; word-break: break-word">
<div role="article" aria-roledescription="email" aria-label lang="en">
<div class="sm-px-4" style="background-color: #f8fafc; font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif">
<table align="center" style="margin: 0 auto" cellpadding="0" cellspacing="0" role="none">
<tr>
<td style="width: 552px; max-width: 100%">
<div role="separator" style="line-height: 24px">&zwj;</div>
<table style="width: 100%" cellpadding="0" cellspacing="0" role="none">
<tr>
<td class="sm-p-6" style="border-radius: 8px; background-color: #fffffe; padding: 24px 36px; border: 1px solid #e2e8f0">
<a href="https://app.staffplan.com">
<img src="https://app.staffplan.com/assets/staffplan-logo-notext-568affe9b8becd2bc88fd2fed64d0c42075d02916b900ec4a04ac651b5788431.png" width="70" alt="StaffPlan" style="max-width: 100%; vertical-align: middle">
</a>
<div role="separator" style="line-height: 24px">&zwj;</div>
<h1 style="margin: 0 0 24px; font-size: 24px; line-height: 32px; font-weight: 600; color: #0f172a">
<%= @greeting %>
</h1>
<p style="margin: 0 0 24px; font-size: 16px; line-height: 24px; color: #475569">
Thanks for registering for StaffPlan. The next step is to <%= link_to 'confirm your email address', @magic_link %> by clicking the link below:
</p>
<div>
<a href="<%= @magic_link %>" style="display: inline-block; text-decoration: none; padding: 16px 24px; font-size: 16px; line-height: 1; border-radius: 4px; color: #fffffe; background-color: #020617" class="hover-bg-slate-800">
<!--[if mso]><i style="mso-font-width: 150%; mso-text-raise: 31px" hidden>&emsp;</i><![endif]-->
<span style="mso-text-raise: 16px">Sign in to StaffPlan</span>
<!--[if mso]><i hidden style="mso-font-width: 150%">&emsp;&#8203;</i><![endif]-->
</a>
</div>
<p style="margin: 0 0 24px; font-size: 16px; line-height: 24px; color: #475569">
Happy Planning!
</p>
<div role="separator" style="line-height: 24px">&zwj;</div>
<p style="margin: 0; font-size: 16px; line-height: 24px; color: #475569">
Thanks,
<br>
<span style="font-weight: 600">StaffPlan</span>
</p>
</td>
</tr>
</table>
<table style="width: 100%" cellpadding="0" cellspacing="0" role="none">
<tr>
<td class="sm-px-6" style="padding: 24px 36px">
<p style="margin: 0; font-size: 12px; color: #64748b">
&copy; <%= Date.today.year %> StaffPlan. All rights reserved.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</body>
Loading