@@ -1438,204 +1438,6 @@ defmodule AlgoraWeb.Org.DashboardLive do
1438
1438
"""
1439
1439
end
1440
1440
1441
- defp match_card ( assigns ) do
1442
- ~H"""
1443
- < div class = "group relative flex flex-col lg:flex-row xl:items-center lg:justify-between gap-4 sm:gap-8 lg:gap-4 xl:gap-6 border bg-card rounded-xl text-card-foreground shadow p-4 pt-8 " >
1444
- < div class = "lg:basis-[52%] w-full truncate " >
1445
- < div class = "flex items-center justify-between gap-4 " >
1446
- < div class = "flex items-center gap-4 " >
1447
- < . link navigate = { User . url ( @ match . user ) } >
1448
- < . avatar class = "h-16 w-16 rounded-full " >
1449
- < . avatar_image src = { @ match . user . avatar_url } alt = { @ match . user . name } />
1450
- < . avatar_fallback class = "rounded-lg " >
1451
- { Algora.Util . initials ( @ match . user . name ) }
1452
- </ . avatar_fallback >
1453
- </ . avatar >
1454
- </ . link >
1455
-
1456
- < div >
1457
- < div class = "flex items-center gap-4 text-foreground " >
1458
- < . link
1459
- navigate = { User . url ( @ match . user ) }
1460
- class = "text-base sm:text-lg font-semibold hover:underline "
1461
- >
1462
- { @ match . user . name } { Algora.Misc.CountryEmojis . get ( @ match . user . country ) }
1463
- </ . link >
1464
- < . badge
1465
- :if = { @ match . badge_text }
1466
- variant = { @ match . badge_variant }
1467
- size = "lg "
1468
- class = "shrink-0 absolute top-0 left-0 "
1469
- >
1470
- { @ match . badge_text }
1471
- </ . badge >
1472
- </ div >
1473
- < div
1474
- :if = { @ match . user . provider_meta }
1475
- class = "flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground sm:text-sm "
1476
- >
1477
- < . link
1478
- :if = { @ match . user . provider_login }
1479
- href = { "https://github.com/#{ @ match . user . provider_login } " }
1480
- target = "_blank "
1481
- class = "flex items-center gap-1 hover:underline "
1482
- >
1483
- < Logos . github class = "shrink-0 h-4 w-4 " />
1484
- < span class = "line-clamp-1 " > { @ match . user . provider_login } </ span >
1485
- </ . link >
1486
- < . link
1487
- :if = { @ match . user . provider_meta [ "twitter_handle" ] }
1488
- href = { "https://x.com/#{ @ match . user . provider_meta [ "twitter_handle" ] } " }
1489
- target = "_blank "
1490
- class = "flex items-center gap-1 hover:underline "
1491
- >
1492
- < . icon name = "tabler-brand-x " class = "shrink-0 h-4 w-4 " />
1493
- < span class = "line-clamp-1 " > { @ match . user . provider_meta [ "twitter_handle" ] } </ span >
1494
- </ . link >
1495
- </ div >
1496
- </ div >
1497
- </ div >
1498
- </ div >
1499
- < div class = "pt-4 text-sm sm:text-base text-muted-foreground font-medium " >
1500
- Completed
1501
- < span class = "font-semibold font-display text-foreground/80 " >
1502
- { @ match . user . transactions_count }
1503
- { ngettext (
1504
- "bounty" ,
1505
- "bounties" ,
1506
- @ match . user . transactions_count
1507
- ) }
1508
- </ span >
1509
- across
1510
- < span class = "font-semibold font-display text-foreground/80 " >
1511
- { ngettext (
1512
- "%{count} project" ,
1513
- "%{count} projects" ,
1514
- @ match . user . contributed_projects_count
1515
- ) }
1516
- </ span >
1517
- </ div >
1518
- < div class = "flex flex-col gap-3 mt-2 " >
1519
- <%= for { owner , contributions } <- aggregate_contributions ( @ contributions ) |> Enum . take ( 3 ) do %>
1520
- < . link
1521
- href = { "https://github.com/#{ owner . provider_login } /#{ List . first ( contributions ) . repository . name } /pulls?q=author%3A#{ @ match . user . provider_login } +is%3Amerged+" }
1522
- target = "_blank "
1523
- rel = "noopener "
1524
- class = "flex items-center gap-3 rounded-xl pr-2 bg-card/50 border border-border/50 hover:border-border transition-all "
1525
- >
1526
- < img
1527
- src = { owner . avatar_url }
1528
- class = "h-12 w-12 rounded-xl rounded-r-none group-hover:saturate-100 transition-all "
1529
- alt = { owner . name }
1530
- />
1531
- < div class = "w-full flex flex-col text-xs font-medium gap-0.5 " >
1532
- < span class = "flex items-start justify-between gap-5 " >
1533
- < span class = "font-display " >
1534
- { if owner . type == :organization do
1535
- owner . name
1536
- else
1537
- List . first ( contributions ) . repository . name
1538
- end }
1539
- </ span >
1540
- <%= if tech = List . first ( List . first ( contributions ) . repository . tech_stack ) do %>
1541
- < . tech_badge
1542
- variant = "ghost "
1543
- class = "saturate-0 text-[11px] group-hover:saturate-100 transition-all "
1544
- tech = { tech }
1545
- />
1546
- <% end %>
1547
- </ span >
1548
- < div class = "flex items-center gap-2 font-semibold " >
1549
- < span class = "flex items-center text-amber-300 text-xs " >
1550
- < . icon name = "tabler-star-filled " class = "h-4 w-4 mr-1 " />
1551
- { Algora.Util . format_number_compact (
1552
- max ( owner . stargazers_count , total_stars ( contributions ) )
1553
- ) }
1554
- </ span >
1555
- < span class = "flex items-center text-purple-400 text-xs " >
1556
- < . icon name = "tabler-git-pull-request " class = "h-4 w-4 mr-1 " />
1557
- { Algora.Util . format_number_compact ( total_contributions ( contributions ) ) }
1558
- </ span >
1559
- </ div >
1560
- </ div >
1561
- </ . link >
1562
- <% end %>
1563
- </ div >
1564
- <%!-- <div class="pt-4 flex flex-col sm:flex-row sm:flex-wrap xl:flex-nowrap gap-4 lg:gap-4 xl:gap-8">
1565
- <%= for {project, total_earned} <- @match.projects |> Enum.take(2) do %>
1566
- <.link
1567
- navigate={User.url(project)}
1568
- class="flex flex-1 items-center gap-2 sm:gap-4 text-sm rounded-lg"
1569
- >
1570
- <.avatar class="h-10 w-10 rounded-lg saturate-0 bg-gradient-to-br brightness-75">
1571
- <.avatar_image src={project.avatar_url} alt={project.name} />
1572
- <.avatar_fallback class="rounded-lg">
1573
- {Algora.Util.initials(project.name)}
1574
- </.avatar_fallback>
1575
- </.avatar>
1576
- <div class="flex flex-col">
1577
- <div class="text-base font-medium text-foreground/80">
1578
- {project.name}
1579
- </div>
1580
-
1581
- <div class="flex items-center gap-2 whitespace-nowrap">
1582
- <div class="text-sm text-muted-foreground font-display font-semibold">
1583
- <.icon name="tabler-star-filled" class="size-4 text-amber-400 mr-1" />{format_number(
1584
- project.stargazers_count
1585
- )}
1586
- </div>
1587
- <div class="text-sm text-muted-foreground">
1588
- <span class="text-foreground/80 font-display font-semibold">
1589
- {total_earned}
1590
- </span>
1591
- awarded
1592
- </div>
1593
- </div>
1594
- </div>
1595
- </.link>
1596
- <% end %>
1597
- </div> --%>
1598
- </ div >
1599
-
1600
- < div class = "pt-2 lg:pt-0 lg:pl-4 xl:pl-6 lg:basis-[48%] w-full lg:border-l lg:border-border " >
1601
- < dl :if = { @ match [ :hourly_rate ] } class = "pt-4 lg:pt-0 " >
1602
- < div class = "flex flex-col-reverse 3xl:flex-row justify-between items-center gap-2 " >
1603
- < dt class = "text-foreground text-center " >
1604
- Minimum payment to collaborate: < br />
1605
- < span class = "font-semibold font-display " >
1606
- { @ match [ :hourly_rate ]
1607
- |> Money . mult! ( @ match . hours_per_week || 30 )
1608
- |> Money . to_string! ( ) }
1609
- </ span >
1610
- (< span class = "font-semibold " > { @ match . hours_per_week || 30 } </ span > hours booked)
1611
- </ dt >
1612
- < div class = "flex flex-col items-center gap-2 " >
1613
- < . button
1614
- phx-click = "share_opportunity "
1615
- phx-value-user_id = { @ match . user . id }
1616
- phx-value-type = "contract "
1617
- phx-value-contract_type = "marketplace "
1618
- variant = "none "
1619
- class = "group bg-emerald-900/10 text-emerald-300 transition-colors duration-75 hover:bg-emerald-800/10 hover:text-emerald-300 hover:drop-shadow-[0_1px_5px_#34d39980] focus:bg-emerald-800/10 focus:text-emerald-300 focus:outline-none focus:drop-shadow-[0_1px_5px_#34d39980] border border-emerald-400/40 hover:border-emerald-400/50 focus:border-emerald-400/50 h-full py-4 "
1620
- size = "xl "
1621
- >
1622
- < div class = "flex flex-col items-center gap-1 font-semibold " >
1623
- < span > Offer contract</ span >
1624
- < dd class = "font-display font-semibold tabular-nums text-xl " >
1625
- { @ match [ :hourly_rate ] } /hr
1626
- </ dd >
1627
- < div class = "text-xs text-emerald-400 " >
1628
- (includes all fees)
1629
- </ div >
1630
- </ div >
1631
- </ . button >
1632
- </ div >
1633
- </ div >
1634
- </ dl >
1635
- </ div >
1636
- </ div >
1637
- """
1638
- end
1639
1441
1640
1442
defp contract_for_user ( _contracts , _user ) do
1641
1443
nil
@@ -2225,23 +2027,5 @@ defmodule AlgoraWeb.Org.DashboardLive do
2225
2027
end
2226
2028
end
2227
2029
2228
- defp aggregate_contributions ( contributions ) do
2229
- groups = Enum . group_by ( contributions , fn c -> c . repository . user end )
2230
2030
2231
- contributions
2232
- |> Enum . map ( fn c -> { c . repository . user , groups [ c . repository . user ] } end )
2233
- |> Enum . uniq_by ( fn { owner , _ } -> owner . id end )
2234
- end
2235
-
2236
- defp total_stars ( contributions ) do
2237
- contributions
2238
- |> Enum . map ( & & 1 . repository . stargazers_count )
2239
- |> Enum . sum ( )
2240
- end
2241
-
2242
- defp total_contributions ( contributions ) do
2243
- contributions
2244
- |> Enum . map ( & & 1 . contribution_count )
2245
- |> Enum . sum ( )
2246
- end
2247
2031
end
0 commit comments