Skip to content

Commit 33002ab

Browse files
committed
Merge branch 'main' of github.com:algora-io/console into admin-company-analytics
2 parents d62bdc6 + 266e9ff commit 33002ab

File tree

238 files changed

+18925
-12253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+18925
-12253
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ node_modules
3232
/.fly
3333
/xref*
3434
/priv/domain_blacklist.txt
35-
/priv/plts
35+
/priv/plts
36+
/priv/db

.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
PORT=4000
22
LOG_LEVEL=debug
33

4+
LOGIN_CODE_TTL=3600
5+
LOGIN_CODE_SALT="abc123"
6+
47
DATABASE_URL="postgresql://user:pass@localhost:5432/db"
58

69
GITHUB_CLIENT_ID=""
@@ -11,6 +14,8 @@ GITHUB_WEBHOOK_SECRET=""
1114
GITHUB_PRIVATE_KEY=""
1215
GITHUB_PAT=""
1316
GITHUB_PAT_ENABLED=false
17+
GITHUB_OAUTH_STATE_TTL=600
18+
GITHUB_OAUTH_STATE_SALT="abc123"
1419

1520
AWS_ENDPOINT_URL_S3=""
1621
AWS_REGION=""
@@ -31,3 +36,7 @@ APPSIGNAL_OTP_APP="algora"
3136
APPSIGNAL_PUSH_API_KEY="00000000-0000-0000-0000-000000000000"
3237
APPSIGNAL_APP_NAME="AlgoraConsole"
3338
APPSIGNAL_APP_ENV="dev"
39+
40+
SENDGRID_API_KEY="SG.x.x"
41+
42+
DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/1234567890/x"

.github/workflows/elixir.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
9292
- name: Create PLTs
9393
if: steps.plt_cache.outputs.cache-hit != 'true'
94-
run: mix dialyzer --plt
94+
run: MIX_ENV=dev mix dialyzer --plt
9595

9696
- name: Save PLT cache
9797
id: plt_cache_save
@@ -104,4 +104,4 @@ jobs:
104104
priv/plts
105105
106106
- name: Run dialyzer
107-
run: mix dialyzer --format github --format dialyxir
107+
run: MIX_ENV=dev mix dialyzer --format github --format dialyxir

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ npm-debug.log
5454
/xref*
5555
/priv/domain_blacklist.txt
5656
/priv/plts
57-
/priv/dev
57+
/priv/db
58+
/priv/github
59+
/priv/migration
60+
/priv/dev

.iex.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ alias Algora.Accounts
66
alias Algora.Accounts.Identity
77
alias Algora.Accounts.User
88
alias Algora.Admin
9+
alias Algora.Admin.Migration
10+
alias Algora.Bounties
11+
alias Algora.Bounties.Claim
912
alias Algora.Contracts
1013
alias Algora.Contracts.Contract
1114
alias Algora.Contracts.Timesheet
@@ -18,6 +21,11 @@ alias Algora.Payments.Customer
1821
alias Algora.Payments.PaymentMethod
1922
alias Algora.Payments.Transaction
2023
alias Algora.Repo
24+
alias Algora.Settings
25+
alias Algora.Workspace
26+
alias Algora.Workspace.Installation
27+
alias Algora.Workspace.Repository
28+
alias Algora.Workspace.Ticket
2129

2230
IEx.configure(inspect: [charlists: :as_lists, limit: :infinity], auto_reload: true)
2331

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ FROM ${BUILDER_IMAGE} as builder
2323

2424
# install build dependencies
2525
RUN apt-get update -y && apt-get install -y build-essential git \
26-
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
26+
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
2727

2828
# prepare build dir
2929
WORKDIR /app
3030

3131
# install hex + rebar
3232
RUN mix local.hex --force && \
33-
mix local.rebar --force
33+
mix local.rebar --force
3434

3535
# set build ENV
3636
ENV MIX_ENV="prod"
@@ -74,6 +74,9 @@ RUN apt-get update -y && \
7474
apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \
7575
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
7676

77+
# TODO: remove after migration
78+
RUN apt-get update -y && apt-get install -y postgresql-client
79+
7780
COPY --from=node:23-bookworm-slim /usr/local/bin /usr/local/bin
7881

7982
# Set the locale

assets/js/app.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,64 @@ const Hooks = {
461461
});
462462
},
463463
},
464+
InfiniteScroll: {
465+
mounted() {
466+
this.setupObserver();
467+
},
468+
469+
updated() {
470+
// Disconnect previous observer before creating a new one
471+
if (this.observer) {
472+
this.observer.disconnect();
473+
}
474+
this.setupObserver();
475+
},
476+
477+
setupObserver() {
478+
this.observer = new IntersectionObserver(
479+
(entries) => {
480+
const entry = entries[0];
481+
if (entry.isIntersecting) {
482+
this.pushEvent("load_more");
483+
}
484+
},
485+
{
486+
root: null, // viewport
487+
rootMargin: "0px 0px 400px 0px", // trigger when indicator is 400px from viewport
488+
threshold: 0.1,
489+
}
490+
);
491+
492+
// Look for the indicator inside this.el rather than document-wide
493+
const loadMoreIndicator = this.el.querySelector("#load-more-indicator");
494+
if (loadMoreIndicator) {
495+
this.observer.observe(loadMoreIndicator);
496+
}
497+
},
498+
499+
destroyed() {
500+
if (this.observer) {
501+
this.observer.disconnect();
502+
}
503+
},
504+
},
505+
AvatarImage: {
506+
mounted() {
507+
this.handleError = () => {
508+
this.errored = true;
509+
this.el.style.display = "none";
510+
};
511+
this.el.addEventListener("error", this.handleError);
512+
},
513+
updated() {
514+
if (this.errored) {
515+
this.el.style.display = "none";
516+
}
517+
},
518+
destroyed() {
519+
this.el.removeEventListener("error", this.handleError);
520+
},
521+
},
464522
} satisfies Record<string, Partial<ViewHook> & Record<string, unknown>>;
465523

466524
// Accessible focus handling
@@ -643,3 +701,5 @@ window.addEventListener("phx:open_popup", (e: CustomEvent) => {
643701
newWindow.focus();
644702
}
645703
});
704+
705+
export default Hooks;

assets/svelte/TechStack.svelte

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,53 @@
11
<script>
22
export let tech = [];
3+
export let form;
34
export let live;
45
5-
let input = '';
6+
let input = "";
67
let techMap = new Map();
78
89
$: {
910
techMap.clear();
10-
tech.forEach(tech => {
11+
tech.forEach((tech) => {
1112
techMap.set(tech.toLowerCase(), tech);
1213
});
1314
}
1415
1516
function addTech(e) {
16-
if (e.key === 'Enter' || e.key === ',') {
17+
if (e.key === "Enter" || e.key === ",") {
1718
e.preventDefault();
1819
const tech = input.trim();
20+
21+
if (e.key === "Enter" && tech === "") {
22+
e.target.closest("form").requestSubmit();
23+
return;
24+
}
25+
1926
const techLower = tech.toLowerCase();
20-
2127
if (tech && !techMap.has(techLower)) {
2228
techMap.set(techLower, tech);
2329
updateTechStack();
2430
}
25-
input = '';
31+
input = "";
2632
}
2733
}
2834
2935
function removeTech(tech) {
3036
techMap.delete(tech.toLowerCase());
3137
updateTechStack();
32-
3338
}
3439
3540
function updateTechStack() {
3641
const newTechStack = Array.from(techMap.values());
3742
tech = newTechStack;
38-
live.pushEvent('tech_stack_changed', { tech_stack: tech });
43+
live.pushEvent("tech_stack_changed", { tech_stack: tech });
3944
}
4045
</script>
4146

4247
<div class="mt-4">
4348
<input
4449
type="text"
50+
name={`${form}[tech_stack_input]`}
4551
bind:value={input}
4652
on:keydown={addTech}
4753
placeholder="Elixir, Phoenix, PostgreSQL, etc."
@@ -50,13 +56,15 @@
5056

5157
<input
5258
type="hidden"
53-
name="tech_stack_form[tech_stack]"
59+
name={`${form}[tech_stack]`}
5460
value={JSON.stringify(tech)}
5561
/>
5662

5763
<div class="flex flex-wrap gap-3 mt-4">
5864
{#each tech as tech}
59-
<div class="bg-success/10 text-success rounded-lg px-3 py-1.5 text-sm font-semibold flex items-center">
65+
<div
66+
class="bg-success/10 text-success rounded-lg px-3 py-1.5 text-sm font-semibold flex items-center"
67+
>
6068
{tech}
6169
<button
6270
type="button"
@@ -68,4 +76,4 @@
6876
</div>
6977
{/each}
7078
</div>
71-
</div>
79+
</div>

assets/svelte/Timezone.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<script>
2-
import { onMount } from 'svelte';
2+
import { onMount } from "svelte";
33
export let live;
44
55
let timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
66
77
onMount(() => {
88
// Send timezone on component mount
9-
live.pushEvent('timezone_changed', { timezone });
9+
live.pushEvent("timezone_changed", { timezone });
1010
});
1111
</script>
1212

13-
<input type="hidden" name="timezone" value={timezone} />
13+
<input type="hidden" name="timezone" value={timezone} />

config/config.exs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ config :algora,
1717
# Configures the endpoint
1818
config :algora, AlgoraWeb.Endpoint,
1919
url: [host: "localhost"],
20-
adapter: Bandit.PhoenixAdapter,
20+
adapter: Phoenix.Endpoint.Cowboy2Adapter,
2121
render_errors: [
2222
formats: [html: AlgoraWeb.ErrorHTML, json: AlgoraWeb.ErrorJSON],
2323
layout: false
@@ -32,7 +32,14 @@ config :algora, Oban,
3232
comment_consumers: 1,
3333
github_og_image: 5,
3434
notify_bounty: 1,
35-
notify_tip_intent: 1
35+
notify_tip_intent: 1,
36+
notify_claim: 1,
37+
notify_transfer: 100,
38+
prompt_payout_connect: 100,
39+
transfers: 1,
40+
activity_notifier: 1,
41+
activity_mailer: 1,
42+
activity_discord: 10
3643
]
3744

3845
# Configures the mailer

0 commit comments

Comments
 (0)