repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
carlosrojaso/chapter | client/src/modules/dashboard/Sponsors/pages/SponsorsPage.tsx | <gh_stars>10-100
import { VStack, Flex, Heading, Text } from '@chakra-ui/react';
import { DataTable } from 'chakra-data-table';
import { LinkButton } from 'chakra-next-link';
import { NextPage } from 'next';
import Head from 'next/head';
import React from 'react';
import { Layout } from '../../shared/components/Layout'... |
carlosrojaso/chapter | server/src/graphql-types/UserChapterRole.ts | import { ObjectType, Field, Int } from 'type-graphql';
import { User } from './User';
// registerEnumType(ChapterRoles, { name: 'ChapterRoles' });
// TODO: Make this enum
export type ChapterRoles = 'organizer' | 'member';
@ObjectType()
export class UserChapterRole {
@Field(() => Int)
user_id: number;
@Field(()... |
carlosrojaso/chapter | server/prisma/generator/factories/venues.factory.ts | <reponame>carlosrojaso/chapter
import { faker } from '@faker-js/faker';
import { Prisma } from '@prisma/client';
import { prisma } from '../../../src/prisma';
const { company, address } = faker;
const createVenues = async (): Promise<number[]> => {
const venueIds: number[] = [];
for (let i = 0; i < 4; i++) {
... |
carlosrojaso/chapter | server/src/graphql-types/Rsvp.ts | import { ObjectType, Field, Int } from 'type-graphql';
import { User } from '.';
@ObjectType()
export class Rsvp {
@Field(() => Int)
user_id: number;
@Field(() => Int)
event_id: number;
@Field(() => Date)
date: Date;
@Field(() => Boolean)
on_waitlist: boolean;
@Field(() => Date, { nullable: true ... |
carlosrojaso/chapter | server/src/controllers/Messages/resolver.ts | <reponame>carlosrojaso/chapter<filename>server/src/controllers/Messages/resolver.ts
import { Resolver, Mutation, Arg } from 'type-graphql';
import MailerService from '../../services/MailerService';
import { Email } from './Email';
import { SendEmailInputs } from './inputs';
@Resolver()
export class EmailResolver {
... |
carlosrojaso/chapter | server/prisma/generator/factories/rsvps.factory.ts | import { faker } from '@faker-js/faker';
import { Prisma } from '@prisma/client';
import { sub } from 'date-fns';
import { prisma } from '../../../src/prisma';
import { random, randomItems } from '../lib/random';
import { makeBooleanIterator } from '../lib/util';
const { date } = faker;
const createRsvps = async (e... |
carlosrojaso/chapter | server/tests/Mailer.test.ts | import assert from 'assert';
import chai, { expect } from 'chai';
import { stub, restore } from 'sinon';
import sinonChai from 'sinon-chai';
import MailerService from '../src/services/MailerService';
import Utilities from '../src/util/Utilities';
chai.use(sinonChai);
beforeEach(() => {
stub(console, 'warn');
});
... |
carlosrojaso/chapter | server/prisma/generator/factories/sponsors.factory.ts | import { faker } from '@faker-js/faker';
import { Prisma } from '@prisma/client';
import { prisma } from '../../../src/prisma';
import { randomEnum } from '../lib/random';
const { company, internet, system } = faker;
enum SponsorTypes {
'FOOD',
'VENUE',
'OTHER',
}
const createSponsors = async (): Promise<numb... |
carlosrojaso/chapter | server/src/graphql-types/Venue.ts | import { Field, ObjectType, Float } from 'type-graphql';
import { BaseObject } from './BaseObject';
@ObjectType()
export class Venue extends BaseObject {
@Field(() => String)
name: string;
@Field(() => String, { nullable: true })
street_address?: string | null;
@Field(() => String)
city: string;
@Fiel... |
carlosrojaso/chapter | client/src/modules/dashboard/Events/components/EventFormUtils.ts | import {
Event,
Venue,
SponsorsQuery,
EventTag,
} from '../../../../generated/graphql';
export interface Field {
key: keyof EventFormData;
label: string;
placeholder?: string;
type: string;
defaultValue?: string;
isRequired: boolean;
}
export type sponsorType = {
name: string;
logo_path: strin... |
carlosrojaso/chapter | server/prisma/generator/factories/instanceRoles.factory.ts | <reponame>carlosrojaso/chapter<filename>server/prisma/generator/factories/instanceRoles.factory.ts
import { prisma } from '../../../src/prisma';
const instancePermissions = ['chapter-create', 'chapter-edit'] as const;
type Permissions = typeof instancePermissions[number];
interface InstanceRole {
name: string;
per... |
carlosrojaso/chapter | server/src/graphql-types/EventSponsor.ts | import { ObjectType, Field } from 'type-graphql';
import { Sponsor } from './Sponsor';
@ObjectType()
export class EventSponsor {
@Field(() => Sponsor)
sponsor: Sponsor;
}
|
carlosrojaso/chapter | server/src/controllers/Sponsors/resolver.ts | <gh_stars>10-100
import { Prisma } from '@prisma/client';
import { Resolver, Query, Arg, Int, Mutation } from 'type-graphql';
import { Sponsor } from '../../graphql-types/Sponsor';
import { prisma } from '../../prisma';
import { CreateSponsorInputs, UpdateSponsorInputs } from './inputs';
@Resolver()
export class Spon... |
carlosrojaso/chapter | client/src/pages/dashboard/sponsors/[id]/index.tsx | import { SponsorPage } from '../../../../modules/dashboard/Sponsors/pages/SponsorPage';
export default SponsorPage;
|
carlosrojaso/chapter | client/src/modules/events/index.ts | export { EventPage } from './pages/eventPage';
export { EventsPage } from './pages/eventsPage';
|
carlosrojaso/chapter | client/src/components/ChapterCard.tsx | <reponame>carlosrojaso/chapter<filename>client/src/components/ChapterCard.tsx
import {
Stack,
Heading,
Box,
Center,
Image,
Text,
useColorModeValue,
} from '@chakra-ui/react';
import { Link } from 'chakra-next-link';
import React from 'react';
import { Chapter } from 'generated/graphql';
type ChapterCard... |
tinovyatkin/typescript-jest-template | src/index.ts | <filename>src/index.ts
/**
* Bolerplate Typescript files
*/
console.log('Hello world!');
|
blamb102/personal-aws-console | src/app/app.routes.ts | import {Routes, RouterModule} from "@angular/router";
import {ModuleWithProviders} from "@angular/core";
import {HomeLandingComponent, AboutComponent, HomeComponent} from "./public/home.component";
import {SecureHomeComponent} from "./secure/landing/securehome.component";
import {MyProfileComponent} from "./secure/prof... |
blamb102/personal-aws-console | src/app/service/ec2.service.ts | import {environment} from "../../environments/environment";
import {Injectable, Inject} from "@angular/core";
/**
* Created by <NAME>
*/
declare var AWS: any;
export interface Callback {
callback(): void;
callbackWithParam(result: any): void;
}
@Injectable()
export class EC2Service {
constructor() {
... |
blamb102/personal-aws-console | src/app/public/auth/login/login.component.ts | <gh_stars>0
import {Component, OnInit} from "@angular/core";
import {Router} from "@angular/router";
import {CognitoCallback, UserLoginService, LoggedInCallback} from "../../../service/cognito.service";
import {DynamoDBService} from "../../../service/ddb.service";
@Component({
selector: 'my-aws-console-app',
t... |
blamb102/personal-aws-console | src/app/app.module.ts | <gh_stars>0
import {BrowserModule} from "@angular/platform-browser";
import {NgModule} from "@angular/core";
import {FormsModule} from "@angular/forms";
import {HttpModule} from "@angular/http";
import {AppComponent} from "./app.component";
import {UserLoginService, UserParametersService, CognitoUtil} from "./service/c... |
blamb102/personal-aws-console | src/app/service/s3.service.ts | <filename>src/app/service/s3.service.ts
import {environment} from "../../environments/environment";
import {Injectable, Inject} from "@angular/core";
/**
* Created by <NAME>
*/
declare var AWS: any;
export interface Callback {
callback(): void;
callbackWithParam(result: any): void;
}
@Injectable()
export ... |
blamb102/personal-aws-console | src/app/service/cloudflare.service.ts | import {Injectable, Inject} from "@angular/core";
import {S3Service} from "./s3.service";
import {EC2Service} from "./ec2.service";
import {environment} from "../../environments/environment";
import { Http, Headers, Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator... |
blamb102/personal-aws-console | src/app/secure/buckets/mys3objects.component.ts | import {Component} from "@angular/core";
import {LoggedInCallback, UserLoginService, Callback} from "../../service/cognito.service";
import {S3Service} from "../../service/s3.service";
import {Router} from "@angular/router";
export class Objects {
key: string;
}
declare var AWS: any;
@Component({
selector: '... |
blamb102/personal-aws-console | src/app/public/auth/logout/logout.component.ts | <gh_stars>0
import {Component, OnInit, OnDestroy} from "@angular/core";
import {Router, ActivatedRoute} from "@angular/router";
import {UserLoginService, LoggedInCallback} from "../../../service/cognito.service";
@Component({
selector: 'my-aws-console-app',
template: ''
})
export class LogoutComponent implemen... |
blamb102/personal-aws-console | src/app/secure/instances/myinstances.component.ts | import {Component} from "@angular/core";
import {LoggedInCallback, UserLoginService, Callback} from "../../service/cognito.service";
import {EC2Service} from "../../service/ec2.service";
import {CFService} from "../../service/cloudflare.service";
import {Router} from "@angular/router";
import {environment} from "../../... |
blamb102/personal-aws-console | src/environments/environment.ts | export const environment = {
production: false,
region: 'us-west-2',
identityPoolId: 'us-west-2:09114ff0-a193-4d71-8e75-6ed12e3ede1b',
userPoolId: 'us-west-2_Tr3dvlT5B',
clientId: '4galnav88qp60eicu9f17bjf3f',
appBucket: 'my-aws-console-app',
bucketRegion: 'us-west-2',
ec2region: 'us... |
1-aquila-1/typescript | 01-curso/cod3r-01/Introducao/funcoes.ts | <gh_stars>0
// string
let nome: string = 'João'
function retornaMeuNome(): string {
// return minhaIdade
return nome
}
// console.log(retornaMeuNome())
function digaOi(): void {
console.log('Oi')
}
// digaOi()
function multiplicar(numA: any, numB: any): number {
return numA * numB
}
function soma(n... |
1-aquila-1/typescript | 01-curso/cod3r-01/Introducao/tipos/tuplas.ts | <gh_stars>0
let endereco: [string, number] = ['Av. Principal', 99]
console.log(endereco) |
1-aquila-1/typescript | 01-curso/cod3r-01/Introducao/tipos/enums.ts | enum Cor {
Cinza,
Verde,
Azul
}
let minhaCor: Cor = Cor.Verde
// console.log(minhaCor)
enum UF {
PA = "Pará",
SP = "São Paulo"
}
let meuEstado: UF = UF.PA
console.log(meuEstado) |
1-aquila-1/typescript | 01-curso/cod3r-01/Introducao/tipos/tipos.ts | <gh_stars>0
enum Cor{
verde = 10,
azul = 15
}
let cor: Cor = Cor.verde
console.log(cor)
|
1-aquila-1/typescript | 01-curso/01-curso/interfaces/interfaces.ts | interface Humano {
nome: string,
idade?: number
saudar(sobrenome: string):void
}
function saudarComOla(pessoa: Humano){
console.log('Olá', pessoa.nome)
}
function mudarNome(pessoa: Humano){
pessoa.nome = 'Pedro'
}
const pedro: Humano = {
nome: 'Áquila',
idade: 30,
saudar(sobrenome: st... |
1-aquila-1/typescript | 01-curso/cod3r-01/Introducao/tipos/arry.ts | let hobbies: any[] = [1, 2]
console.log(hobbies)
hobbies = ['a', 'b', 'c', 2]
|
TheDancingCode/craft | tailoff/js/components/toggle.component.ts | <gh_stars>0
import { DOMHelper } from '../utils/domHelper';
import { ScrollHelper } from '../utils/scroll';
export class ToggleComponent {
private animationSpeed = 400;
private scrollSpeed = 400;
constructor() {
const targets = document.querySelectorAll('[data-s-toggle]');
Array.from(targets).forEach((t... |
TheDancingCode/craft | tailoff/js/utils/scroll.ts | <filename>tailoff/js/utils/scroll.ts
export class ScrollHelper {
constructor() {}
public static scrollToY(elementY: HTMLElement, duration: number) {
const rect = elementY.getBoundingClientRect();
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
const startingY =
(window... |
TheDancingCode/craft | tailoff/js/plugins/modal/image.plugin.ts | import { ModalComponent } from '../../components/modal.component';
import { AnimationHelper } from '../../utils/animationHelper';
import { ArrayPrototypes } from '../../utils/prototypes/array.prototypes';
import { ModalPlugin } from './plugin.interface';
ArrayPrototypes.activateFrom();
export class ImageModalPlugin i... |
TheDancingCode/craft | tailoff/js/components/indeterminateChecks.component.ts | <reponame>TheDancingCode/craft
export class IndeterminateChecksComponent {
constructor() {
Array.from(document.querySelectorAll('ul.js-indeterminate-checks')).forEach((list: HTMLUListElement, index) => {
new IndeterminateChecks(list, index);
});
}
}
class IndeterminateChecks {
private mainList: HTM... |
TheDancingCode/craft | tailoff/js/components/tooltip.component.ts | import tippy from 'tippy.js';
export class TooltipComponent {
constructor() {
if (document.querySelectorAll('[data-tippy-content]').length > 0) {
this.initTippy();
}
}
private async initTippy() {
// @ts-ignore
const tippy = await import('tippy.js');
tippy.default('[data-tippy-content]'... |
TheDancingCode/craft | tailoff/js/components/pullOut.component.ts | import { DOMHelper } from '../utils/domHelper';
export class PullOutComponent {
constructor() {
if (document.querySelectorAll('.js-pull-out').length > 0) {
this.pullOutBlocks();
window.addEventListener('resize', this.pullOutBlocks.bind(this));
}
DOMHelper.onDynamicContent(document.documentEl... |
TheDancingCode/craft | tailoff/js/ie/ieBanner.component.ts | import { A11yUtils } from './a11y';
export class IEBannerComponent {
private mainContentBlock: HTMLElement;
constructor() {
this.mainContentBlock = document.getElementById('mainContentBlock');
window.addEventListener('cookie-closed', () => {
const banner = document.querySelector('.ie-banner') as HT... |
TheDancingCode/craft | tailoff/js/components/leaflet.component.ts | <reponame>TheDancingCode/craft
import { Ajax } from '../utils/ajax';
export class LeafletComponent {
// private L = window['L'];
constructor() {
const maps = document.querySelectorAll('.leaflet-map');
if (maps.length > 0) {
Array.from(maps).forEach((map: HTMLElement) => {
this.initMap(map);
... |
TheDancingCode/craft | tailoff/js/components/scrollToAnchor.component.ts | import { DOMHelper } from '../utils/domHelper';
import { ScrollHelper } from '../utils/scroll';
export class ScrollToAnchorComponent {
constructor() {
const scrollLinks = document.querySelectorAll('a.js-smooth-scroll');
Array.from(scrollLinks).forEach((link: HTMLAnchorElement) => {
this.initScrollTo(l... |
TheDancingCode/craft | tailoff/js/components/dropdown.component.ts | <filename>tailoff/js/components/dropdown.component.ts<gh_stars>10-100
import { DOMHelper } from '../utils/domHelper';
export class DropdownComponent {
constructor() {
const dropdowns = Array.from(document.querySelectorAll('.js-dropdown'));
dropdowns.forEach((dropdown, index) => {
new DropdownElement(dr... |
TheDancingCode/craft | tailoff/js/plugins/modal/plugin.interface.ts | import { ModalComponent } from '../../components/modal.component';
export interface ModalPluginConstructor {
new (modalComponent?: ModalComponent, options?: {}): ModalPlugin;
}
export interface ModalPlugin {
initElement(): void;
afterCreateModal(): void;
getTriggerClass(): string;
openModalClick(trigger: HT... |
TheDancingCode/craft | tailoff/js/components/table.component.ts | export class TableComponent {
constructor() {
//add data-header to td's in custom table.
Array.from(document.querySelectorAll('.custom-table table')).forEach((table: HTMLTableElement) => {
this.initCustomTable(table);
});
}
private initCustomTable(table: HTMLTableElement) {
Array.from(table... |
TheDancingCode/craft | tailoff/js/components/loadmore.component.ts | <gh_stars>10-100
import { DOMHelper } from '../utils/domHelper';
export class LoadMoreComponent {
private xhr: XMLHttpRequest;
private infiniteScroll = false;
constructor() {
document.addEventListener(
'click',
(e) => {
// loop parent nodes from the target to the delegation node
... |
TheDancingCode/craft | tailoff/js/components/pageFind.component.ts | //You can borrow code and inspiration from http://www.calilighting.com/assets/js/filter/find5.js
import { Helper } from '../utils/helper';
export class PageFindComponent {
private inputElement: HTMLInputElement;
private resultsElement: HTMLElement;
private nextElement: HTMLElement;
private previousElement: HT... |
TheDancingCode/craft | tailoff/js/components/webfont.component.ts | export class WebfontComponent {
private urls: Array<string>;
private key = 'fonts';
private cache;
constructor(urls: Array<string> = []) {
this.urls = urls;
this.cache = window.localStorage.getItem(this.key);
if (this.cache) {
this.insertFonts(this.cache);
this.cacheFonts();
} else ... |
TheDancingCode/craft | tailoff/js/components/masonry.component.ts | export class MasonryComponent {
constructor() {
if ('CSS' in window && CSS.supports('display', 'grid')) {
this.initGridMasonry();
} else {
/**
* Remove the code below when we decide not to support sucky browsers like IE11
* And also remove all the related functions
*/
th... |
TheDancingCode/craft | tailoff/js/components/general.component.ts | <gh_stars>10-100
export class GeneralComponent {
constructor() {
this.addOutlineForTabbers();
}
// This adds a class if the user is tabbing and thus using the keyboard, so the focus style will be visible. Otherwise if it's a clicker the focus is removed.
private addOutlineForTabbers() {
function handle... |
TheDancingCode/craft | tailoff/js/components/formie.component.ts | <filename>tailoff/js/components/formie.component.ts<gh_stars>10-100
import { SiteLang } from '../utils/site-lang';
import { ArrayPrototypes } from '../utils/prototypes/array.prototypes';
ArrayPrototypes.activateFrom();
declare global {
interface Window {
FormieTranslations: any;
}
}
export class FormieCompon... |
TheDancingCode/craft | tailoff/js/components/glide.component.ts | <reponame>TheDancingCode/craft
import { DOMHelper } from '../utils/domHelper';
import { Info } from '../utils/info';
export class GlideComponent {
constructor() {
const sliders = Array.from(document.querySelectorAll('.js-slider'));
if (sliders.length > 0) {
this.processSliders(sliders);
}
DOMH... |
TheDancingCode/craft | tailoff/js/components/ajaxSearch.component.ts | <reponame>TheDancingCode/craft
// based on: https://adamsilver.io/articles/building-an-accessible-autocomplete-control/
// import Promise from "promise-polyfill";
import { Ajax } from '../utils/ajax';
import { DOMHelper } from '../utils/domHelper';
import { SiteLang } from '../utils/site-lang';
import { Formatter } fr... |
TheDancingCode/craft | tailoff/js/components/videoBackground.component.ts | <reponame>TheDancingCode/craft
declare global {
interface Window {
onYouTubeIframeAPIReady: any;
YT: any;
}
}
export class VideoBackgroundComponent {
constructor() {
const videos = document.querySelectorAll('.js-video-bg');
Array.from(videos).forEach((video) => {
this.initVideo(video as HTM... |
TheDancingCode/craft | tailoff/js/components/datepicker.component.ts | <gh_stars>0
// import flatpickr from 'flatpickr';
import { DOMHelper } from '../utils/domHelper';
import { SiteLang } from '../utils/site-lang';
const lang = SiteLang.getLang();
export class DatePickerComponent {
constructor() {
const pickers = document.querySelectorAll('.js-date-picker');
if (pickers.lengt... |
TheDancingCode/craft | tailoff/js/ie.ts | <filename>tailoff/js/ie.ts
import '../css/ie.css';
import { IEBannerComponent } from './ie/ieBanner.component';
new IEBannerComponent();
|
TheDancingCode/craft | tailoff/js/components/modal.component.ts | import { SiteLang } from '../utils/site-lang';
import { A11yUtils } from '../utils/a11y';
import 'wicg-inert';
import { ModalPlugin, ModalPluginConstructor } from '../plugins/modal/plugin.interface';
export class ModalComponent {
private lang = require(`../i18n/s-modal-${SiteLang.getLang()}.json`);
private options... |
RadarRadarRadar/practice-template | scripts/build.ts | <reponame>RadarRadarRadar/practice-template
import { build } from "esbuild";
/**
* Generic options passed during build.
*/
interface BuildOptions {
env: "production" | "development";
}
/**
* A builder function for the app package.
*/
export async function buildApp(options: BuildOptions) {
const { env } = opti... |
RadarRadarRadar/practice-template | packages/common/src/index.ts | <gh_stars>10-100
export const APP_TITLE = "tutorial-app";
|
Lusito/typed-undomanager | src/UndoableEdit.ts | <filename>src/UndoableEdit.ts
/* eslint-disable @typescript-eslint/no-unused-vars */
/**
* The base class for undoables
*/
export abstract class UndoableEdit {
/**
* This action reverts the changes of the edit.
*/
public abstract undo(): void;
/**
* This action re-applies the changes of t... |
Lusito/typed-undomanager | src/index.ts | <reponame>Lusito/typed-undomanager
export * from "./UndoManager";
export * from "./UndoableEdit";
|
Lusito/typed-undomanager | src/UndoManager.ts | import { UndoableEdit } from "./UndoableEdit";
/**
* The UndoManager keeps track of all editables.
*/
export class UndoManager {
private edits: UndoableEdit[] = [];
private position = 0;
private unmodifiedPosition = 0;
private limit: number;
private listener: null | (() => void) = null;
... |
Lusito/typed-undomanager | src/UndoManager.spec.ts | <gh_stars>1-10
import { UndoableEdit } from "./UndoableEdit";
import { UndoManager } from "./UndoManager";
class UndoableSpy extends UndoableEdit {
public undoneCount = 0;
public redoneCount = 0;
public undo(): void {
this.undoneCount++;
}
public redo(): void {
this.redoneCount++... |
niklaskorz/nkchat | packages/client/src/components/organisms/Chat/index.tsx | import gql from 'graphql-tag';
import Linkify from 'linkifyjs/react';
import React from 'react';
import { ChildProps, compose, graphql, MutationFunc } from 'react-apollo';
import { Helmet } from 'react-helmet';
import ChatError from '../../molecules/ChatError';
import Embed, { Props as EmbedProps } from '../../molecule... |
niklaskorz/nkchat | packages/server/typings/mongodb.d.ts | declare module 'mongodb' {
export { ObjectID } from 'typeorm';
}
|
niklaskorz/nkchat | packages/client/src/components/pages/LoginPage.tsx | <reponame>niklaskorz/nkchat
import * as colors from 'colors';
import formatError from 'formatError';
import gql from 'graphql-tag';
import React from 'react';
import { ChildProps, compose, graphql, MutationFunc } from 'react-apollo';
import { Helmet } from 'react-helmet';
import { Link, Redirect } from 'react-router-do... |
niklaskorz/nkchat | packages/server/src/resolvers/MessageResolver.ts | import getUrls from 'get-urls';
import { ObjectID } from 'mongodb';
import {
Arg,
Ctx,
Field,
FieldResolver,
InputType,
Mutation,
Publisher,
PubSub,
Resolver,
Root,
Subscription,
} from 'type-graphql';
import { MongoRepository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-exte... |
niklaskorz/nkchat | packages/server/src/models/Room.ts | <filename>packages/server/src/models/Room.ts
import { ObjectID } from 'mongodb';
import { Field, ObjectType } from 'type-graphql';
import { Column, Entity, ObjectIdColumn } from 'typeorm';
import { User } from './User';
@ObjectType({
description:
'A room contains information about the messages sent into the room... |
niklaskorz/nkchat | packages/client/src/components/molecules/RoomList.tsx | <filename>packages/client/src/components/molecules/RoomList.tsx
import * as colors from 'colors';
import React from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import swal from 'sweetalert2';
import SideBar from './SideBar';
const ActionBar = styled.div`
flex-shrink: 0;
... |
niklaskorz/nkchat | packages/server/typings/get-urls.d.ts | declare module 'get-urls' {
function getUrls(text: string, options?: any): Set<string>;
export = getUrls;
}
|
niklaskorz/nkchat | packages/client/src/colors.ts | export const darkPrimary = '#353b48';
export const darkSecondary = '#2f3640';
export const darkPrimaryText = '#f5f6fa';
export const darkSecondaryText = '#dcdde1';
export const primary = '#f5f6fa';
export const secondary = '#dcdde1';
export const primaryText = '#000';
export const secondaryText = '#2f3640';
export co... |
niklaskorz/nkchat | packages/client/src/components/molecules/ChatError.tsx | <filename>packages/client/src/components/molecules/ChatError.tsx
import formatError from 'formatError';
import React from 'react';
import CenteredContainer from '../atoms/CenteredContainer';
import ErrorMessage from '../atoms/ErrorMessage';
interface Props {
errorMessage: string;
}
export default class ChatError ex... |
niklaskorz/nkchat | packages/server/src/models/index.ts | export * from './Message';
export * from './Room';
export * from './User';
|
niklaskorz/nkchat | packages/server/src/Context.ts | import Cookies from 'cookies';
import { User } from './models';
export interface State {
sessionId?: string;
viewer?: User;
}
export default interface Context {
cookies?: Cookies;
state: State;
}
|
niklaskorz/nkchat | packages/server/src/constants.ts | // One week
export const SESSION_EXPIRY_SECONDS = 1 * 7 * 24 * 60 * 60;
export const SESSION_EXPIRY_MILLISECONDS = SESSION_EXPIRY_SECONDS * 1000;
|
niklaskorz/nkchat | packages/server/src/config.ts | export const mongodbHost = process.env.MONGODB_HOST || '127.0.0.1';
export const natsHost = process.env.NATS_HOST || '127.0.0.1';
export const redisHost = process.env.REDIS_HOST || '127.0.0.1';
export const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 4000;
|
niklaskorz/nkchat | packages/server/src/scalars/index.ts | <filename>packages/server/src/scalars/index.ts
export * from './ObjectIDScalar';
|
niklaskorz/nkchat | packages/server/src/sessions.ts | import Redis from 'ioredis';
import { ObjectID } from 'mongodb';
import { getMongoRepository } from 'typeorm';
import { redisHost } from './config';
import { SESSION_EXPIRY_SECONDS } from './constants';
import { User } from './models';
const redis = new Redis(`redis://${redisHost}`);
export const loadSession = async ... |
niklaskorz/nkchat | packages/client/src/components/molecules/SideBar.tsx | import * as colors from 'colors';
import React from 'react';
import styled from 'styled-components';
const Section = styled.section`
background: ${colors.darkPrimary};
color: #fff;
min-width: 0;
flex: 0 0 250px;
display: flex;
flex-direction: column;
`;
const Header = styled.header`
padding: 15px;
f... |
niklaskorz/nkchat | packages/server/src/resolvers/RoomResolver.ts | import { ObjectID } from 'mongodb';
import {
Arg,
Ctx,
Field,
FieldResolver,
InputType,
Mutation,
Publisher,
PubSub,
Query,
Resolver,
Root,
Subscription,
} from 'type-graphql';
import { MongoRepository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions';
import Context... |
niklaskorz/nkchat | packages/server/src/resolvers/index.ts | <gh_stars>10-100
export * from './MessageResolver';
export * from './RoomResolver';
export * from './UserResolver';
|
niklaskorz/nkchat | packages/server/src/schema.ts | import { ObjectID } from 'mongodb';
import { buildSchema } from 'type-graphql';
import { MessageResolver, RoomResolver, UserResolver } from './resolvers';
import { ObjectIDScalar } from './scalars';
import { pubSub } from './subscriptions';
const getSchema = () =>
buildSchema({
resolvers: [MessageResolver, RoomR... |
niklaskorz/nkchat | packages/client/src/formatError.ts | <reponame>niklaskorz/nkchat
const trimLeft = 'GraphQL error: ';
export default (message: string): string => {
if (message.startsWith(trimLeft)) {
return message.slice(trimLeft.length);
}
return message;
};
|
niklaskorz/nkchat | packages/client/src/components/atoms/ErrorMessage.ts | <reponame>niklaskorz/nkchat<filename>packages/client/src/components/atoms/ErrorMessage.ts
import * as colors from 'colors';
import styled from 'styled-components';
export default styled.div`
border-radius: 2px;
padding: 15px;
margin-bottom: 20px;
background: ${colors.error};
color: #fff;
`;
|
niklaskorz/nkchat | packages/client/src/components/molecules/NothingHere.tsx | <reponame>niklaskorz/nkchat
import React from 'react';
import CenteredContainer from '../atoms/CenteredContainer';
export default class NothingHere extends React.Component {
render() {
return (
<CenteredContainer>
<p>Welcome! Join a room or create a new one to get started.</p>
</CenteredConta... |
niklaskorz/nkchat | packages/server/src/models/User.ts | <reponame>niklaskorz/nkchat<gh_stars>10-100
import { ObjectID } from 'mongodb';
import { Field, ObjectType } from 'type-graphql';
import { Column, Entity, Index, ObjectIdColumn } from 'typeorm';
@ObjectType({
description: 'A user is a user, not much left to say here',
})
@Entity()
export class User {
@Field(type =... |
niklaskorz/nkchat | packages/client/src/components/molecules/RoomInfo.tsx | <reponame>niklaskorz/nkchat
import * as colors from 'colors';
import React from 'react';
import styled from 'styled-components';
import SideBar from './SideBar';
const SubTitle = styled.h3`
font-size: 0.9em;
margin: 0;
font-weight: normal;
margin-top: 10px;
padding: 0 15px;
`;
const RoomIdText = styled.inpu... |
niklaskorz/nkchat | packages/server/src/subscriptions.ts | import * as config from './config';
import NatsPubSub from './nats-subscriptions/NatsPubSub';
export enum SubscriptionType {
MessageWasSent = 'MessageWasSent',
RoomWasUpdated = 'RoomWasUpdated',
UserJoinedRoom = 'UserJoinedRoom',
}
export const pubSub = new NatsPubSub({
url: `nats://${config.natsHost}:4222`,
... |
niklaskorz/nkchat | packages/server/src/resolvers/UserResolver.ts | <reponame>niklaskorz/nkchat<filename>packages/server/src/resolvers/UserResolver.ts<gh_stars>10-100
import * as bcrypt from 'bcrypt';
import { ObjectID } from 'mongodb';
import {
Arg,
Ctx,
Field,
FieldResolver,
InputType,
Mutation,
Query,
Resolver,
Root,
} from 'type-graphql';
import { MongoRepository ... |
niklaskorz/nkchat | packages/server/src/scalars/ObjectIDScalar.ts | import { GraphQLScalarType, Kind, ValueNode } from 'graphql';
import { ObjectID } from 'mongodb';
export const ObjectIDScalar = new GraphQLScalarType({
name: 'ObjectID',
description: 'Object id scalar type',
parseValue(value: string) {
return ObjectID.createFromHexString(value);
},
parseLiteral(node: Val... |
niklaskorz/nkchat | packages/client/src/apollo.ts | <gh_stars>10-100
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloClient } from 'apollo-client';
import { Operation, split } from 'apollo-link';
import { HttpLink } from 'apollo-link-http';
import { WebSocketLink } from 'apollo-link-ws';
import { getMainDefinition } from 'apollo-utilities';
const ... |
niklaskorz/nkchat | packages/client/src/components/App.tsx | <gh_stars>10-100
import React from 'react';
import { ApolloProvider } from 'react-apollo';
import { Helmet } from 'react-helmet';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import apolloClient from '../apollo';
import ChatPage from './pages/ChatPage';
import LoginPage from './pages/LoginPage';
cl... |
niklaskorz/nkchat | packages/server/src/models/Message.ts | <filename>packages/server/src/models/Message.ts
import { ObjectID } from 'mongodb';
import { Field, ObjectType, registerEnumType } from 'type-graphql';
import { Column, Entity, ObjectIdColumn } from 'typeorm';
export enum EmbedType {
Youtube = 'YOUTUBE',
Alugha = 'ALUGHA',
Image = 'IMAGE',
}
registerEnumType(Em... |
niklaskorz/nkchat | packages/server/src/nats-subscriptions/NatsPubSub.ts | import { PubSubEngine } from 'graphql-subscriptions';
import { ObjectID } from 'mongodb';
import { Client, ClientOpts, connect } from 'nats';
import PubSubAsyncIterator from './PubSubAsyncIterator';
const reviver = (key: string, value: any) => {
if (ObjectID.isValid(value)) {
return ObjectID.createFromHexString(... |
niklaskorz/nkchat | packages/server/src/index.ts | <reponame>niklaskorz/nkchat
import 'reflect-metadata';
import * as typegraphql from 'type-graphql';
import { Container } from 'typedi';
import * as typeorm from 'typeorm';
import winston from 'winston';
import * as config from './config';
import { Message, Room, User } from './models';
import startServer from './start... |
niklaskorz/nkchat | packages/client/src/components/pages/ChatPage.tsx | <filename>packages/client/src/components/pages/ChatPage.tsx
import { ApolloQueryResult } from 'apollo-client';
import gql from 'graphql-tag';
import { History, Location } from 'history';
import React from 'react';
import { ChildProps, compose, graphql, MutationFunc } from 'react-apollo';
import { Redirect } from 'react... |
niklaskorz/nkchat | packages/server/src/startServer.ts | import { ApolloServer } from 'apollo-server-koa';
import Cookies from 'cookies';
import { createServer, ServerResponse } from 'http';
import Koa from 'koa';
import { SESSION_EXPIRY_MILLISECONDS } from './constants';
import Context, { State } from './Context';
import getSchema from './schema';
import { loadSession } fro... |
react-epic/deviation | src/StoreInjector.ts | import { IProviderToStoreMap } from './Injectable'
import { PureDeviation } from './PureDeviation'
import { Store } from './Store'
interface IStoreInjectorProps {
providers: IProviderToStoreMap
}
export class StoreInjector<S> extends Store<
IStoreInjectorProps,
S
> {
constructor(deviation: PureDeviation) {
... |
react-epic/deviation | src/Store.ts | import { isFunction } from 'lodash'
import { Subject } from 'rxjs'
import { IProviderToStoreMap } from './Injectable'
export const notifier: unique symbol = Symbol('notifier')
export class Store<P = {}, S extends Object = {}> {
public props: Readonly<P>
public state: S;
public [notifier]: Subject<S> = new Sub... |
react-epic/deviation | src/ConstructorType.ts | // tslint:disable-next-line interface-name
export interface AnyConstructorType<T> {
new (...args: any[]): T
}
// tslint:disable-next-line interface-name
export interface ConstructorType<
T extends { new (...args: any[]): any }
> {
new (...args: ConstructorParameters<T>): T
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.