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

v0.0.10 #605

Merged
merged 27 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3a08d49
custom mini profile popover
Jul 4, 2023
c77cb2f
search subscriptions and interests
Jul 4, 2023
930d8d8
toggle subscribe
Jul 4, 2023
0b27823
profile card ui fixes
Jul 5, 2023
9c9c286
Fix: minor UI changes on profile popup
gagansuie Jul 5, 2023
18f6c9e
Merge pull request #587 from sitaradev/profile-fixes
gagansuie Jul 5, 2023
0b976dc
Chore: format code
gagansuie Jul 5, 2023
77b0c5c
Merge pull request #588 from gagan-suie/dev
gagansuie Jul 5, 2023
b8740bb
Feat: changed streak icon to fire
gagansuie Jul 5, 2023
22b8f76
Merge pull request #589 from gagan-suie/dev
gagansuie Jul 5, 2023
12bad23
Fix: isPaidPlan null with removed users
gagansuie Jul 6, 2023
15ef17a
Merge pull request #590 from gagan-suie/dev
gagansuie Jul 6, 2023
eaa5860
Merge remote-tracking branch 'upstream/main' into dev
gagansuie Jul 6, 2023
ddcd562
Fix: package conflicts causing crash
gagansuie Jul 6, 2023
87294ad
Merge pull request #592 from gagan-suie/dev
gagansuie Jul 6, 2023
49fc894
Fix: made profile tabs reactive to feature flags
gagansuie Jul 7, 2023
ff5766b
Merge pull request #593 from gagan-suie/dev
gagansuie Jul 7, 2023
e042a6f
Fix: redirect contact, legal, and careers page
gagansuie Jul 8, 2023
a389e42
Merge pull request #594 from gagan-suie/dev
gagansuie Jul 8, 2023
1f1796e
Fix: added link to footer copyright
gagansuie Jul 8, 2023
a8dc3e5
Merge pull request #595 from gagan-suie/dev
gagansuie Jul 8, 2023
a47fb25
Fix: message dropdown not opening and using socket viewers instead of…
gagansuie Jul 9, 2023
db07ffe
Fix: commands and ai not working properly
gagansuie Jul 9, 2023
1cd5815
Fix: chat message sending
gagansuie Jul 9, 2023
83fc488
Fix: prevent users from selecting host or non-viewers
gagansuie Jul 9, 2023
8834850
Fix: New guests not getting access when granted role
gagansuie Jul 9, 2023
71dbb20
Merge pull request #603 from gagan-suie/dev
gagansuie Jul 9, 2023
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
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage-website",
"version": "0.0.9",
"version": "0.0.10",
"license": "GPL-3.0",
"private": true,
"type": "module",
Expand Down Expand Up @@ -34,8 +34,8 @@
"eslint-plugin-svelte3": "^4.0.0",
"postcss": "^8.4.21",
"postcss-cli": "^10.1.0",
"prettier": "^3.0.0",
"prettier-plugin-svelte": "^2.9.0",
"prettier": "^2.8.4 <2.9.0",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^3.55.1",
"svelte-check": "^3.0.4",
"svelte-preprocess": "^5.0.1",
Expand All @@ -53,7 +53,7 @@
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/typography": "^0.5.9",
"animate.css": "^4.1.1",
"daisyui": "^3.1.0",
"daisyui": "^3.2.1",
"emoji-picker-element": "^1.18.1",
"nprogress": "^0.2.0",
"playwright-e2e-coverage-report": "^1.0.28",
Expand Down
2 changes: 1 addition & 1 deletion src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const handle: Handle = async ({ event, resolve }) => {
}

if (Authenticate({ pathname, user_role: role || 'user' })) {
if (maintenanceMode && !['/contact', '/legal', '/careers'].includes(pathname)) {
if (maintenanceMode) {
if (pathname === '/maintenance') {
return await resolve(event)
} else {
Expand Down
6 changes: 5 additions & 1 deletion src/lib/assets/icons/drawer/IconDrawerStreak.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" />
d="M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z" />
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z" />
</svg>
6 changes: 5 additions & 1 deletion src/lib/assets/icons/profile/IconProfileStreak.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" />
d="M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z" />
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M12 18a3.75 3.75 0 00.495-7.467 5.99 5.99 0 00-1.925 3.546 5.974 5.974 0 01-2.133-1A3.75 3.75 0 0012 18z" />
</svg>
2 changes: 1 addition & 1 deletion src/lib/components/Browse/Sections/ItemCarousel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<p class="text-2xl truncate text-white font-semibold">{channel.title || ''}</p>
<div class="flex flex-row items-center gap-2">
<div class="avatar">
<div class="w-14 mask {channel.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<div class="w-14 mask {channel?.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<img src={channel.avatar} alt="" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Browse/Sections/ItemChannel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<p class="text-lg font-semibold truncate">{channel.title}</p>
<div class="flex flex-row gap-2 max-w-[25rem]">
<div class="avatar">
<div class="w-12 mask {channel.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<div class="w-12 mask {channel?.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<img src={channel.avatar} alt="" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Browse/Sections/ItemTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<td>
<div class="flex items-center space-x-2 my-3 pl-3">
<div class="avatar">
<div class="w-12 mask {channel.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<div class="w-12 mask {channel?.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<img src={channel.avatar} alt="" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Browse/Sections/ItemUser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<a class="rounded-md" href="/profile/{user.username}">
<div class="text-center space-y-3 w-[200px]">
<div class="avatar">
<div class="w-36 mask {user.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<div class="w-36 mask {user?.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<img src={user.avatar} alt="" />
</div>
</div>
Expand Down
10 changes: 7 additions & 3 deletions src/lib/components/Browse/Sections/SectionCarousel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import IconDrawerChevron from '$lib/assets/icons/drawer/IconDrawerChevron.svelte'
import LoadingItemCarousel from '$lib/components/Browse/Sections/LoadingItemCarousel.svelte'
import { onMount } from 'svelte'
import Swiper, { Navigation } from 'swiper'
import Swiper from 'swiper'
import { Navigation } from 'swiper/modules'

import ItemCarousel from '$lib/components/Browse/Sections/ItemCarousel.svelte'
import 'swiper/css'

Expand Down Expand Up @@ -60,7 +62,8 @@
{:then value}
{#if value?.length > 0}
<div class={'relative p-1 transition-opacity ease-in duration-100 ' + swiperClass}>
<div class="btn btn-neutral text-white p-2 btn-prev btn-square absolute top-2/4 left-1 z-10 ml-3">
<div
class="btn btn-neutral text-white p-2 btn-prev btn-square absolute top-2/4 left-1 z-10 ml-3">
<IconDrawerLeft />
</div>
<div class="swiper carousel !pt-10 mx-8">
Expand All @@ -70,7 +73,8 @@
{/each}
</div>
</div>
<div class="btn btn-neutral text-white z-10 p-2 btn-next btn-square absolute top-2/4 right-1 mr-3">
<div
class="btn btn-neutral text-white z-10 p-2 btn-next btn-square absolute top-2/4 right-1 mr-3">
<IconDrawerChevron />
</div>
</div>
Expand Down
38 changes: 22 additions & 16 deletions src/lib/components/Channel/Chat/ChatInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import EmojiPicker from '$lib/components/Channel/Chat/EmojiPicker.svelte'
import GifPicker from '$lib/components/Channel/Chat/GifPicker.svelte'

export let channel: any
export let users: any
export let channel: any,
viewers: any[] = []

let selectedCommand = 0
let selectedUser = 0
let inputBox: any = null
Expand All @@ -19,14 +20,18 @@
$channel_connection === `open-${channel._id}` && $page.data.user?.userId
$: isHost = channel.user === $page.data.user?.userId

$: viewersWithOutHost = viewers.filter((viewer) => viewer.userId !== channel.user)

function insert(str: string, index: number, value: string) {
return str.substr(0, index) + value + str.substr(index)
}

const sendMessage = () => {
if (messageIsCommand) {
if (selectedCommand && selectedUser >= 0) {
const user = users[selectedUser]
if (messageIsCommand && !chatMessage.startsWith('/ai ')) {
if (selectedCommand) {
const usernameFromMsg = chatMessage.substring(chatMessage.indexOf('@') + 1)
const user = viewersWithOutHost.find((viewer: any) => viewer.username === usernameFromMsg)
if (!user) return
executeCommand(selectedCommand, user.userId)
}
} else if (!chatMessage.startsWith('/') || chatMessage.startsWith('/ai')) {
Expand Down Expand Up @@ -55,15 +60,15 @@
}

const slectCommandfromKey = (key: string) => {
if (key === 'ArrowDown' && selectedCommand < 3) {
if (key === 'ArrowDown' && selectedCommand < 4) {
selectedCommand++
} else if (key === 'ArrowUp' && selectedCommand >= 1) {
} else if (key === 'ArrowUp' && selectedCommand >= 2) {
selectedCommand--
}
}

const slectUserfromKey = (key: string) => {
if (key === 'ArrowDown' && selectedUser < users.length) {
if (key === 'ArrowDown' && selectedUser < viewers.length) {
selectedUser++
} else if (key === 'ArrowUp' && selectedUser >= 0) {
selectedUser--
Expand Down Expand Up @@ -109,6 +114,7 @@
// toggle commands handlers

const toggleBan = (userId: string) => {
if (channel.user === userId) return
let isEnabled = false
if (!channel.bans.includes(userId)) {
channel.bans.push(userId)
Expand All @@ -126,6 +132,7 @@
}

const toggleMod = (userId: string) => {
if (channel.user === userId) return
if (!channel.bans.includes(userId)) {
let isEnabled = false
if (!channel.mods?.includes(userId)) {
Expand All @@ -143,6 +150,7 @@
}

const toggleGuest = (userId: string) => {
if (channel.user === userId) return
if (!channel.bans.includes(userId)) {
let isEnabled = false
if (!channel.guests.includes(userId) && channel.guests.length < 9) {
Expand Down Expand Up @@ -187,16 +195,14 @@
]

$: messageIsCommand =
chatMessage &&
chatMessage.startsWith('/') &&
/[a-z] @[a-z]/.test(chatMessage.substr(1)) &&
chatMessage.startsWith('/ai ')
chatMessage && chatMessage.startsWith('/') && /[a-z] @[a-z]/.test(chatMessage.substr(1))

$: showUsers = chatMessage && chatMessage.endsWith('@')
$: showCommandOptions =
chatMessage &&
chatMessage.startsWith('/') &&
!chatMessage.startsWith('/ai ') &&
!chatMessage.includes('@') &&
(channel.user === $page.data.user?.userId || channel.mods?.includes($page.data.user?.userId)) &&
!showUsers
</script>
Expand Down Expand Up @@ -253,12 +259,12 @@
</div>
{/if}

{#if users.length > 0 && showUsers}
{#if viewersWithOutHost.length > 0 && showUsers}
<div
class={'dropdown dropdown-top w-full rounded-box bg-white ' +
(showUsers ? 'dropdown-open' : '')}>
<ul class="dropdown-content menu p-2 shadow bg-base-300 rounded-box w-full">
{#each users as user, idx}
{#each viewersWithOutHost as user, idx}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li
on:click={() => {
Expand Down Expand Up @@ -293,8 +299,8 @@
e.preventDefault()
if (showUsers) {
if (selectedUser >= 0) {
const user = users[selectedUser]
chatMessage = chatMessage.replace(/@/, '@' + user.username) + ' '
const user = viewers[selectedUser]
chatMessage = chatMessage.replace(/@/, '@' + user.username)
}
} else {
if (selectedCommand) {
Expand Down
21 changes: 6 additions & 15 deletions src/lib/components/Channel/Chat/DrawerChat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
import LastItemInViewport from '$lib/actions/LastItemInViewport'

export let channel: any = undefined,
showEditChannelDrawer: boolean = false
showEditChannelDrawer: boolean = false,
viewers: any[] = []
let chatHistory: any[] = [],
chatDrawerElement: HTMLElement
let cursor = "";
let cursor = ''

channel_message.subscribe((value) => {
if (!value) return
Expand All @@ -30,7 +31,7 @@
channel,
currentUserId: $page.data.user?.userId
})
return message;
return message
})

chatHistory = [...chatHistory, ...messages]
Expand Down Expand Up @@ -68,14 +69,6 @@
$is_chat_drawer_open = false
})

const createuserList = (list: any[]) => {
let users: any = {}
list.forEach((chat) => {
if ($page.data.user?.userId !== chat.user.userId) users[chat.user.userId] = chat.user
})
return Object.keys(users).map((key) => users[key])
}

const loadMore = () => {
if (
$channel_connection === `open-${channel._id}` &&
Expand All @@ -85,12 +78,10 @@
channelSocket: channel.socket,
channelId: channel._id,
skip: 100,
cursor: cursor || "none"
cursor: cursor || 'none'
})
}
}

$: users = createuserList(chatHistory)
</script>

<div class="bg-base-100 flex flex-col overflow-y-hidden w-72 md:w-full h-full rounded-lg">
Expand All @@ -102,6 +93,6 @@
<span use:LastItemInViewport on:loadMore={loadMore} />
</div>
<div class="flex flex-row mt-auto p-3 w-full">
<ChatInput bind:channel bind:users />
<ChatInput bind:channel bind:viewers />
</div>
</div>
2 changes: 1 addition & 1 deletion src/lib/components/Channel/Chat/DropdownViewChannel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<a href="/profile/{host?.username}">
<div class="flex flex-wrap gap-2">
<div class="avatar online">
<div class="w-12 mask {host.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<div class="w-12 mask {host?.isPaidPlan ? 'mask-hexagon' : 'mask-squircle'}">
<img src={host?.avatar} alt="" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Channel/Chat/FloatingMenu.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { clickOutside } from '../../../utils.js'
import { clickOutside } from '$lib/utils.js'
export let id: string = 'float-menu'
export let icon: any = null
export let label: string = '',
Expand Down
Loading