Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: onboarding workflow and progress
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Jun 18, 2023
1 parent 5eb1c8d commit a53414a
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 52 deletions.
66 changes: 33 additions & 33 deletions .github/workflows/vercel-preview.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: Deploy to Vercel Preview
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
workflow_dispatch:
push:
branches:
- manage-forms
# name: Deploy to Vercel Preview
# env:
# VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
# VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# on:
# workflow_dispatch:
# push:
# branches:
# - manage-forms

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install Vercel CLI
run: npm install --global vercel@latest
- name: pull Vercel environment information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: build project artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: deploy project artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
- name: assign beta domain
run: |
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > domain.txt
vercel alias --scope ${{ secrets.VERCEL_TEAM_ID }} --token ${{ secrets.VERCEL_TOKEN }} set `cat domain.txt` linkfree-preview.vercel.app
load-data:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: load json files
if: steps.changes.outputs.data == 'true'
run: curl -f https://linkfree-preview.vercel.app/api/system/reload?secret=${{ secrets.LINKFREE_API_SECRET_PREVIEW }}
# jobs:
# deploy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: install Vercel CLI
# run: npm install --global vercel@latest
# - name: pull Vercel environment information
# run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
# - name: build project artifacts
# run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
# - name: deploy project artifacts to Vercel
# run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
# - name: assign beta domain
# run: |
# vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > domain.txt
# vercel alias --scope ${{ secrets.VERCEL_TEAM_ID }} --token ${{ secrets.VERCEL_TOKEN }} set `cat domain.txt` linkfree-preview.vercel.app
# load-data:
# runs-on: ubuntu-latest
# needs: deploy
# steps:
# - name: load json files
# if: steps.changes.outputs.data == 'true'
# run: curl -f https://linkfree-preview.vercel.app/api/system/reload?secret=${{ secrets.LINKFREE_API_SECRET_PREVIEW }}
14 changes: 8 additions & 6 deletions pages/account/manage/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export default function Profile({ BASE_URL, profile, fileExists }) {
});
const [layout, setLayout] = useState(profile.layout || "classic");
const [name, setName] = useState(profile.name);
const [bio, setBio] = useState(profile.bio);
const [bio, setBio] = useState(
profile.bio || "Have a look at my links below..."
);
const [tags, setTags] = useState(profile.tags || []);
const layouts = ["classic", "inline"];

Expand Down Expand Up @@ -109,7 +111,7 @@ export default function Profile({ BASE_URL, profile, fileExists }) {
{fileExists && (
<Alert
type="warning"
message={`"data/${profile.username}.json" already exists. Please remove this file and your folder via a Pull Request so you can manage your account via these forms`}
message={`"data/${profile.username}.json" already exists. Please remove this file and your folder via a Pull Request so you can manage your account via these forms.`}
/>
)}

Expand Down Expand Up @@ -187,8 +189,8 @@ export default function Profile({ BASE_URL, profile, fileExists }) {
value={name}
onChange={(e) => setName(e.target.value)}
required
minlength="2"
maxlength="32"
minLength="2"
maxLength="32"
/>
</div>
</div>
Expand All @@ -200,8 +202,8 @@ export default function Profile({ BASE_URL, profile, fileExists }) {
value={bio}
onChange={(e) => setBio(e.target.value)}
required
minlength="2"
maxlength="256"
minLength="2"
maxLength="256"
/>
<p className="text-sm text-gray-500">
You can use Markdown syntax.
Expand Down
13 changes: 8 additions & 5 deletions pages/account/no-profile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { authOptions } from "../api/auth/[...nextauth]";
import { getServerSession } from "next-auth/next";

import { clientEnv } from "@config/schemas/clientSchema";
import Page from "@components/Page";
import PageHead from "@components/PageHead";
import Link from "@components/Link";
Expand All @@ -17,11 +19,11 @@ export async function getServerSideProps(context) {
}

return {
props: {},
props: { BASE_URL: clientEnv.NEXT_PUBLIC_BASE_URL },
};
}

export default function NoProfile() {
export default function NoProfile({ BASE_URL }) {
return (
<>
<PageHead
Expand All @@ -37,14 +39,15 @@ export default function NoProfile() {
Your LinkFree Profile does not exist yet
</h2>
<p className="mx-auto mt-6 max-w-xl text-lg leading-8 text-primary-medium">
Please follow the QuickStart guide to create your Profile
Please follow the QuickStart guide to create your Profile or
click on the Forms button to create your Profile
</p>
<div className="mt-10 flex items-center justify-center gap-x-6">
<Link
href="https://linkfree.eddiehub.io/eddiejaoude"
href={`${BASE_URL}/account/manage/profile`}
className="rounded-md bg-secondary-high px-3.5 py-1.5 text-base font-semibold leading-7 text-white shadow-sm hover:bg-secondary-low focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-secondary-high"
>
Example
Go to Forms
</Link>
<Link
href="https://linkfree.eddiehub.io/docs/quickstart"
Expand Down
10 changes: 2 additions & 8 deletions pages/account/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Alert from "@components/Alert";
import Page from "@components/Page";
import PageHead from "@components/PageHead";
import { abbreviateNumber } from "@services/utils/abbreviateNumbers";
import BasicCards from "@components/statistics/BasicCards";
import Button from "@components/Button";
import FallbackImage from "@components/FallbackImage";
import { ReactMarkdown } from "react-markdown/lib/react-markdown";
Expand Down Expand Up @@ -56,12 +55,10 @@ export async function getServerSideProps(context) {

let data = {};
let profileSections = [
"bio",
"links",
"milestones",
"tags",
"socials",
"location",
"testimonials",
];
let progress = {
Expand All @@ -76,7 +73,7 @@ export async function getServerSideProps(context) {
}

progress.missing = profileSections.filter(
(property) => !Object.keys(profile).includes(property)
(property) => !profile[property]?.length
);
progress.percentage = (
((profileSections.length - progress.missing.length) /
Expand Down Expand Up @@ -153,10 +150,7 @@ export default function Statistics({ data, profile, progress, BASE_URL }) {
</div>
</div>
<div className="mt-5 flex justify-center sm:mt-0">
<Button
href={`${process.env.NEXT_PUBLIC_BASE_URL}/${profile.username}`}
primary={true}
>
<Button href={`${BASE_URL}/${profile.username}`} primary={true}>
VIEW PROFILE
</Button>
</div>
Expand Down
1 change: 1 addition & 0 deletions pages/api/account/manage/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export async function updateProfileApi(username, data) {
try {
getProfile = await Profile.findOneAndUpdate({ username }, updateProfile, {
upsert: true,
new: true,
});
log.info(`profile created for username: ${username}`);
} catch (e) {
Expand Down

0 comments on commit a53414a

Please sign in to comment.