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

Feat quest #1631

Open
wants to merge 30 commits into
base: test-server
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2bf8ed8
feat: discord login page
ArshdeepGrover Oct 29, 2024
3a00856
feat: create quest tab in admin community pannel
ArshdeepGrover Oct 29, 2024
07098b7
feat: admin quest page
ArshdeepGrover Nov 7, 2024
8f97962
refactor: add index table for quest list
ArshdeepGrover Nov 7, 2024
5b8ee7a
feat: add pagination in quest list
ArshdeepGrover Nov 7, 2024
fc9c6ee
refactor: revamp table for quest list
ArshdeepGrover Nov 8, 2024
d7bf95f
feat: edit, create, tasks
ArshdeepGrover Nov 8, 2024
6063bd3
fix: update quest details
ArshdeepGrover Nov 9, 2024
213e505
feat: task component
ArshdeepGrover Nov 9, 2024
3800f2b
feat: list of task types
ArshdeepGrover Nov 19, 2024
986cb07
feat: add task card, create task, index task
ArshdeepGrover Nov 20, 2024
953de12
feat: quest public page
ArshdeepGrover Nov 20, 2024
c163bda
feat: public task list
ArshdeepGrover Nov 20, 2024
3ad2c71
feat: add task list in public side
ArshdeepGrover Nov 21, 2024
95aa451
feat: external user token index
ArshdeepGrover Nov 21, 2024
1d1af74
refactor: redirect path for quest
ArshdeepGrover Nov 25, 2024
7500195
feat: redirect to discord page
ArshdeepGrover Nov 26, 2024
001923d
feat: add discord verification for server member
ArshdeepGrover Nov 27, 2024
6e50e01
feat: add quest task types
ArshdeepGrover Nov 28, 2024
4bceadd
style: quest task creation
ArshdeepGrover Nov 29, 2024
1ef3f16
feat: public side for quest
ArshdeepGrover Nov 29, 2024
8f09c0b
feat: instagram and telegram callback components
ArshdeepGrover Nov 30, 2024
4bd72b1
feat: create quest user response
ArshdeepGrover Nov 30, 2024
b0a832b
feat: add quest on public community page
ArshdeepGrover Dec 2, 2024
90c6b21
feat: quest task popups
ArshdeepGrover Dec 3, 2024
336b893
feat: user Participants card
ArshdeepGrover Dec 3, 2024
e93c3f7
refactor: task card
ArshdeepGrover Dec 3, 2024
c9fd464
feat: quest card for public side
ArshdeepGrover Dec 4, 2024
1efa31f
feat: add loader while fetching data for quest
ArshdeepGrover Dec 4, 2024
41a2bfd
refactor: update instagram client_id
ArshdeepGrover Dec 4, 2024
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
16 changes: 16 additions & 0 deletions apps/commudle-admin/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const routes: Routes = [
loadChildren: () =>
import('./feature-modules/public-community/public-community.module').then((m) => m.PublicCommunityModule),
},
{
path: 'auth/users',
loadChildren: () => import('./feature-modules/user-oauth/user-oauth.module').then((m) => m.UserOauthModule),
},
{
path: 'communities/:community_id/events/:event_id',
loadChildren: () =>
Expand All @@ -142,6 +146,11 @@ const routes: Routes = [
loadChildren: () =>
import('./feature-modules/public-hackathon/public-hackathon.module').then((m) => m.PublicHackathonModule),
},
{
path: 'communities/:community_id/quests/:quest_id',
loadChildren: () =>
import('./feature-modules/public-quests/public-quests.module').then((m) => m.PublicQuestsModule),
},
{
path: 'communities/:community_id/channels',
loadChildren: () =>
Expand Down Expand Up @@ -264,6 +273,13 @@ const routes: Routes = [
path: 'communities/:community_id/event-dashboard',
loadChildren: () => import('./feature-modules/events/events.module').then((m) => m.EventsModule),
},
{
path: 'communities/:community_id/quest-dashboard',
loadChildren: () =>
import('./feature-modules/quests-control-panel/quests-control-panel.module').then(
(m) => m.QuestsControlPanelModule,
),
},
{
path: 'orgs',
loadChildren: () =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @nx/enforce-module-boundaries */
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommunityAdminNotificationsComponent } from 'apps/commudle-admin/src/app/feature-modules/community-control-panel/components/community-admin-notifications/community-admin-notifications.component';
Expand All @@ -24,6 +25,8 @@ import { AdminCommunityHackathonComponent } from './components/admin-community-h
import { CommunityBankDetailsComponent } from 'apps/commudle-admin/src/app/feature-modules/community-control-panel/components/community-payments/community-bank-details/community-bank-details.component';
import { CommunityPaymentLogsComponent } from 'apps/commudle-admin/src/app/feature-modules/community-control-panel/components/community-payments/community-payment-logs/community-payment-logs.component';
import { PaymentLogEdfegComponent } from 'apps/shared-components/payment-detail/payment-log-edfeg/payment-log-edfeg.component';
import { CommunityQuestComponent } from 'apps/commudle-admin/src/app/feature-modules/community-control-panel/components/community-quest/community-quest.component';
import { QuestFormComponent } from 'apps/shared-components/quest-form/quest-form.component';
const routes = [
{
path: 'new',
Expand Down Expand Up @@ -136,6 +139,10 @@ const routes = [
path: 'team',
component: CommunityTeamComponent,
},
{
path: 'quests',
component: CommunityQuestComponent,
},
{
path: 'channels',
component: CommunityChannelsAndForumsComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @nx/enforce-module-boundaries */
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
Expand Down Expand Up @@ -58,6 +59,7 @@ import { CommunityChannelsModule } from 'apps/commudle-admin/src/app/feature-mod
import { AdminCommunityHackathonComponent } from './components/admin-community-hackathon/admin-community-hackathon.component';
import { CommunityPaymentLogsComponent } from 'apps/commudle-admin/src/app/feature-modules/community-control-panel/components/community-payments/community-payment-logs/community-payment-logs.component';
import { CommunityBankDetailsComponent } from 'apps/commudle-admin/src/app/feature-modules/community-control-panel/components/community-payments/community-bank-details/community-bank-details.component';
import { CommunityQuestComponent } from 'apps/commudle-admin/src/app/feature-modules/community-control-panel/components/community-quest/community-quest.component';

@NgModule({
declarations: [
Expand Down Expand Up @@ -86,6 +88,7 @@ import { CommunityBankDetailsComponent } from 'apps/commudle-admin/src/app/featu
AdminCommunityHackathonComponent,
CommunityPaymentLogsComponent,
CommunityBankDetailsComponent,
CommunityQuestComponent,
],
imports: [
CommonModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,12 @@ <h4>{{ community.name }}</h4>
<nb-icon icon="people" status="success"></nb-icon>
<span class="title">Members</span>
</a>
<a [routerLink]="['quests']" class="d-flex" routerLinkActive="active">
<fa-icon [icon]="icons.faShapes"></fa-icon>
<span class="title">Quests</span>
</a>
<a [routerLink]="['forms']" class="d-flex" routerLinkActive="active">
<fa-icon [icon]="faScroll"></fa-icon>
<fa-icon [icon]="icons.faScroll"></fa-icon>
<span class="title">Forms</span>
</a>
<a [routerLink]="['pages']" class="d-flex com-relative" routerLinkActive="active">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ICommunity } from 'apps/shared-models/community.model';
import { EemailTypes } from 'apps/shared-models/enums/email_types.enum';
import { SeoService } from 'apps/shared-services/seo.service';
import { Subscription } from 'rxjs';
import { faScroll } from '@fortawesome/free-solid-svg-icons';
import { faScroll, faShapes } from '@fortawesome/free-solid-svg-icons';
import { NotificationsStore } from 'apps/commudle-admin/src/app/feature-modules/notifications/store/notifications.store';
import { GoogleTagManagerService } from 'apps/commudle-admin/src/app/services/google-tag-manager.service';
import { ENotificationSenderTypes } from 'apps/shared-models/enums/notification_sender_types.enum';
Expand All @@ -27,14 +27,15 @@ export class CommunityControlPanelComponent implements OnInit, OnDestroy {

notificationCount = 0;
ENotificationSenderTypes = ENotificationSenderTypes;
faScroll = faScroll;

subscriptions: Subscription[] = [];
icons = {
faBuildingColumns,
faFileLines,
faNewspaper,
faMessage,
faShapes,
faScroll,
};
environment = environment;
darkMode: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!-- <button (click)="loginToDiscord()">Login with Discord</button> -->
<section>
<button nbButton [routerLink]="['../quest-dashboard', 'new']" status="primary" outline>
<fa-icon [icon]="icons.faPlus"></fa-icon>&nbsp; New Quest
</button>

<table *ngIf="quests && quests.length > 0">
<tr>
<th>Name</th>
<th>Creation date</th>
<th>Dates</th>
<th>No of tasks</th>
<th>No of participants</th>
<th>Actions</th>
</tr>
<tr *ngFor="let quest of quests">
<td>{{ quest.name }}</td>
<td>{{ moment(quest.created_at).format('dddd, MMM Do, YYYY') }}</td>
<td>
<div *ngIf="quest.start_date; else noDate">
<small *ngIf="quest.start_date">Start at: {{ moment(quest.start_date).format('dddd, MMM Do, YYYY') }}</small>
<br />
<small *ngIf="quest.end_date">End at: {{ moment(quest.end_date).format('dddd, MMM Do, YYYY') }}</small>
</div>
<ng-template #noDate>
<span>No Date selected yet!</span>
</ng-template>
</td>
<td>{{ quest.tasks_count }}</td>
<td>{{ quest.participants_count }}</td>
<td>
<div class="action-buttons">
<a [routerLink]="['/admin', 'communities', communityId, 'quest-dashboard', quest.slug]">
<button nbButton status="primary" size="tiny">Dashboard</button>
</a>
<a [routerLink]="['/communities', communityId, 'quests', quest.slug]" target="_blank">
<button nbButton status="primary" size="tiny">
<fa-icon [icon]="icons.faArrowUpRightFromSquare"></fa-icon>
&nbsp;Public Page
</button>
</a>
</div>
</td>
</tr>
</table>
<div class="pagination">
<app-pagination
(goTo)="page = $event; getQuests()"
(next)="page = $event; getQuests()"
(previous)="page = $event; getQuests()"
*ngIf="total > 0"
[count]="count"
[current]="page"
[total]="total"
></app-pagination>
</div>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
section {
@apply com-p-6;

table {
@apply com-border-collapse com-w-full com-mt-4;

td,
th {
@apply com-border com-border-solid com-border-Bright-Gray com-text-left com-p-2;
}

tr:nth-child(even) {
@apply com-bg-Bright-Gray;
}

.action-buttons {
@apply com-flex com-justify-evenly;
}
}

.pagination {
@apply com-mt-4;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';

import { CommunityQuestComponent } from './community-quest.component';

describe('CommunityQuestComponent', () => {
let component: CommunityQuestComponent;
let fixture: ComponentFixture<CommunityQuestComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [CommunityQuestComponent],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(CommunityQuestComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { EDbModels, IQuest } from '@commudle/shared-models';
import { ExternalUserAuthHandlerService, QuestService } from '@commudle/shared-services';
import { faPlus, faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons';
import moment from 'moment';

@Component({
selector: 'commudle-community-quest',
templateUrl: './community-quest.component.html',
styleUrls: ['./community-quest.component.scss'],
})
export class CommunityQuestComponent implements OnInit {
communityId: number | string;
quests: IQuest[];
moment = moment;
page = 1;
total = 0;
count = 10;
icons = {
faPlus,
faArrowUpRightFromSquare,
};

constructor(
private externalUserAuthHandlerService: ExternalUserAuthHandlerService,
private questService: QuestService,
private activatedRoute: ActivatedRoute,
) {}

ngOnInit() {
this.activatedRoute.parent.params.subscribe((params) => {
this.communityId = params.community_id;
this.getQuests();
});
}

loginToDiscord() {
this.externalUserAuthHandlerService.loginToDiscord();
}

getQuests() {
this.questService.index(EDbModels.KOMMUNITY, this.communityId, this.page, this.count).subscribe((data) => {
this.quests = data.values;
this.page = data.page;
this.total = data.total;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ <h1 class="com-text-Yankees-Blue">{{ community.name }}</h1>
/>
<span class="title">Hackathons</span>
</a>
<a [routerLink]="['quests']" class="d-flex" routerLinkActive="active">
<fa-icon [icon]="faShapes" class="com-text-2xl com-leading-none"></fa-icon>
<span class="title">Quest</span>
</a>
<!-- <a [routerLink]="['resources']" routerLinkActive="active">
<nb-icon icon="award" status="info"></nb-icon>
<span>Sessions by Experts</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { NbDialogService, NbMenuService } from '@commudle/theme';
import { GoogleTagManagerService } from 'apps/commudle-admin/src/app/services/google-tag-manager.service';
import { ENotificationSenderTypes } from 'apps/shared-models/enums/notification_sender_types.enum';
import { CustomPageService } from 'apps/commudle-admin/src/app/services/custom-page.service';
import { faCaretDown, faMessage, faNewspaper } from '@fortawesome/free-solid-svg-icons';
import { faCaretDown, faMessage, faNewspaper, faShapes } from '@fortawesome/free-solid-svg-icons';
import { NewsletterService } from 'apps/commudle-admin/src/app/services/newsletter.service';
import { DarkModeService } from 'apps/commudle-admin/src/app/services/dark-mode.service';
import { EDbModels } from '@commudle/shared-models';
Expand Down Expand Up @@ -42,6 +42,7 @@ export class HomeCommunityComponent implements OnInit, OnDestroy {
faCaretDown = faCaretDown;
faMessage = faMessage;
faNewspaper = faNewspaper;
faShapes = faShapes;

items = [{ title: 'pages', slug: 'pages' }];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<nb-card>
<nb-card-body>
<div *ngIf="isLoading; else questCards">
<commudle-loading-spinner></commudle-loading-spinner>
</div>
<ng-template #questCards>
<div class="quest-cards">
<div *ngFor="let quest of quests">
<commudle-quest-card [quest]="quest"></commudle-quest-card>
</div>
</div>
</ng-template>
</nb-card-body>
</nb-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
nb-card {
@apply com-mx-0;
nb-card-body {
.quest-cards {
@apply com-grid com-grid-cols-3 com-gap-4;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';

import { PublicCommunityQuestsComponent } from './public-community-quests.component';

describe('PublicCommunityQuestsComponent', () => {
let component: PublicCommunityQuestsComponent;
let fixture: ComponentFixture<PublicCommunityQuestsComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [PublicCommunityQuestsComponent],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(PublicCommunityQuestsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { EDbModels, ICommunity, IQuest } from '@commudle/shared-models';
import { QuestService } from '@commudle/shared-services';

@Component({
selector: 'commudle-public-community-quests',
templateUrl: './public-community-quests.component.html',
styleUrls: ['./public-community-quests.component.scss'],
})
export class PublicCommunityQuestsComponent implements OnInit {
community: ICommunity;
quests: IQuest[];
page = 1;
total = 10;
count = 10;
isLoading = true;
constructor(private questService: QuestService, private activatedRoute: ActivatedRoute) {}

ngOnInit() {
this.activatedRoute.parent.data.subscribe((data) => {
this.community = data.community;
this.getQuests();
});
}

getQuests() {
this.questService.publicIndex(EDbModels.KOMMUNITY, this.community.id, this.page, this.count).subscribe((data) => {
this.isLoading = false;
this.quests = data.values;
this.page = data.page;
this.total = data.total;
});
}
}
Loading