Skip to content

Commit

Permalink
feat: add config option to hide the work capacity/compensation fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Jul 4, 2024
1 parent 63ca6af commit e5405b1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 38 deletions.
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ PUBLIC_TRAEFIK_CONFIG_HOST="127.0.0.1:9523"

FEEDBACK_WEBHOOK=""

PUBLIC_SHOW_WORK_CAPACITY="false"
PUBLIC_URL=http://localhost:9523
PUBLIC_DOMAIN=localhost:9523
PUBLIC_INSTANCE_NAME="Weird.One"
Expand Down
35 changes: 19 additions & 16 deletions src/routes/(app)/auth/v1/account/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { env } from '$env/dynamic/public';
import { parseUsername } from '$lib/utils';
import Avatar from '$lib/components/Avatar.svelte';
import { PUBLIC_SHOW_WORK_CAPACITY } from '$env/static/public';
const { data }: { data: PageData } = $props();
const providers = data.providers;
Expand Down Expand Up @@ -338,22 +339,24 @@

<div class="pl-3 text-sm">Contact info will only be shown to logged-in users.</div>
</label>
<label class="label">
<span>Work Capacity</span>
<select class="select" name="work_capacity" bind:value={work_capacity}>
<option value={null}>Not Specified</option>
<option value="part_time">Part Time</option>
<option value="full_time">Full Time</option>
</select>
</label>
<label class="label">
<span>Work Compensation</span>
<select class="select" name="work_compensation" bind:value={work_compensation}>
<option value={null}>Not Specified</option>
<option value="paid">Paid</option>
<option value="volunteer">Volunteer</option>
</select>
</label>
{#if env.PUBLIC_SHOW_WORK_CAPACITY == 'true'}
<label class="label">
<span>Work Capacity</span>
<select class="select" name="work_capacity" bind:value={work_capacity}>
<option value={null}>Not Specified</option>
<option value="part_time">Part Time</option>
<option value="full_time">Full Time</option>
</select>
</label>
<label class="label">
<span>Work Compensation</span>
<select class="select" name="work_compensation" bind:value={work_compensation}>
<option value={null}>Not Specified</option>
<option value="paid">Paid</option>
<option value="volunteer">Volunteer</option>
</select>
</label>
{/if}

<label class="label">
<span>Sub-Profiles</span>
Expand Down
25 changes: 14 additions & 11 deletions src/routes/(app)/members/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { env } from '$env/dynamic/public';
import { PUBLIC_SHOW_WORK_CAPACITY } from '$env/static/public';
import Avatar from '$lib/components/Avatar.svelte';
import { parseUsername } from '$lib/utils';
import type { WorkCapacity, WorkCompensation } from '../auth/v1/account/proxy+page.server';
Expand Down Expand Up @@ -125,17 +126,19 @@
{profile.contact_info}
</div>
{/if}
<div>
{#if profile.work_capacity}
{printWorkCapacity(profile.work_capacity)}
{/if}
{#if profile.work_capacity && profile.work_compensation}
&nbsp;/&nbsp;
{/if}
{#if profile.work_compensation}
{printWorkCompensation(profile.work_compensation)}
{/if}
</div>
{#if env.PUBLIC_SHOW_WORK_CAPACITY == 'true'}
<div>
{#if profile.work_capacity}
{printWorkCapacity(profile.work_capacity)}
{/if}
{#if profile.work_capacity && profile.work_compensation}
&nbsp;/&nbsp;
{/if}
{#if profile.work_compensation}
{printWorkCompensation(profile.work_compensation)}
{/if}
</div>
{/if}
</div>
</div>
</div>
Expand Down
25 changes: 14 additions & 11 deletions src/routes/(app)/u/[username]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { env } from '$env/dynamic/public';
import { PUBLIC_SHOW_WORK_CAPACITY } from '$env/static/public';
import Avatar from '$lib/components/Avatar.svelte';
import { parseUsername } from '$lib/utils';
import type { WorkCapacity, WorkCompensation } from '../../auth/v1/account/proxy+page.server';
Expand Down Expand Up @@ -84,17 +85,19 @@
{profile.contact_info}
</div>
{/if}
{#if profile.work_capacity}
<div>
<strong>Work Capacity: </strong>
{printWorkCapacity(profile.work_capacity)}
</div>
{/if}
{#if profile.work_compensation}
<div>
<strong>Work Compensation: </strong>
{printWorkCompensation(profile.work_compensation)}
</div>
{#if env.PUBLIC_SHOW_WORK_CAPACITY == 'true'}
{#if profile.work_capacity}
<div>
<strong>Work Capacity: </strong>
{printWorkCapacity(profile.work_capacity)}
</div>
{/if}
{#if profile.work_compensation}
<div>
<strong>Work Compensation: </strong>
{printWorkCompensation(profile.work_compensation)}
</div>
{/if}
{/if}
{#if profile.mastodon_server && profile.mastodon_username && profile.username}
<a
Expand Down

0 comments on commit e5405b1

Please sign in to comment.