Skip to content

Commit

Permalink
Merge branch 'development' into fix/dash
Browse files Browse the repository at this point in the history
  • Loading branch information
aliosmandev authored Nov 4, 2023
2 parents e9ce683 + 87cca9b commit fc240f7
Show file tree
Hide file tree
Showing 41 changed files with 9,878 additions and 404 deletions.
1 change: 0 additions & 1 deletion apps/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"react-i18next": "^13.0.1",
"react-icons": "^4.10.1",
"react-infinite-scroll-component": "^6.1.0",
"react-lazy-load-image-component": "^1.6.0",
"react-redux": "^8.1.2",
"remark-gfm": "^3.0.1",
"swiper": "^10.2.0",
Expand Down
6 changes: 3 additions & 3 deletions apps/next/public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"announcement": {
"description": "We're launching soon on",
"button": "get notified!"
"button": "get notified 🚀"
},
"feedback": {
"title": "Feedback",
Expand Down Expand Up @@ -130,8 +130,8 @@
"search": "Search"
},
"search_no_result": {
"title": "Sonuç bulunamadı.",
"description": "Aradığınızı bulabilmek için aramanızı veya filtrelerinizi ayarlamayı deneyin."
"title": "No results found.",
"description": "Try adjusting your search or filters to find what you're looking for."
},
"error_404": {
"title": "Oops, something went wrong.",
Expand Down
33 changes: 25 additions & 8 deletions apps/next/src/components/Auth/SocialProviders/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import getUrl from "@/utils/getUrl";
import { Button } from "@wordigo/ui";
import { RotateCw } from "lucide-react";
import { signIn } from "next-auth/react";
import { useTranslation } from "next-i18next";
import { useState } from "react";

const SocialProviders = () => {
const { t } = useTranslation();
const [isLoading, setIsLoading] = useState(false);

const signInWithGoogle = async () => {
setIsLoading(true);
await signIn("google", { callbackUrl: getUrl() });
};

Expand All @@ -16,16 +21,28 @@ const SocialProviders = () => {
<span className="w-full border-t" />
</div>
<div className="relative flex justify-center text-xs uppercase">
<span className="bg-background px-2 text-muted-foreground">{t("auth_layout.with_section_title")}</span>
<span className="bg-background px-2 text-muted-foreground">
{t("auth_layout.with_section_title")}
</span>
</div>
</div>
<Button className="w-full" onClick={signInWithGoogle} variant="outline" type="button">
<svg viewBox="0 0 24 24" className="mr-2 h-4 w-4">
<path
fill="currentColor"
d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"
/>
</svg>
<Button
className="w-full"
onClick={signInWithGoogle}
variant="outline"
disabled={isLoading}
type="button"
>
{isLoading ? (
<RotateCw className="mr-2 h-4 w-4 animate-spin" />
) : (
<svg viewBox="0 0 24 24" className="mr-2 h-4 w-4">
<path
fill="currentColor"
d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"
/>
</svg>
)}
{t("auth_layout.contiune_google")}
</Button>
</div>
Expand Down
112 changes: 112 additions & 0 deletions apps/next/src/components/Dashboard/Dictionaries/TestTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import { DataTable } from "@/components/DataTable/data-table";
import { DataTableColumnHeader } from "@/components/DataTable/data-table-column-header";
import { type ColumnDef } from "@tanstack/react-table";
import { Badge } from "@wordigo/ui";
import * as React from "react";
import { MdPublic, MdPublicOff } from "react-icons/md";
import { type IDictionary } from "types/global";

interface TasksTableShellProps {
data: any[];
pageCount: number;
}

export function TasksTableShell({ data, pageCount }: TasksTableShellProps) {
// Memoize the columns so they don't re-render on every render
const columns = React.useMemo<ColumnDef<IDictionary, unknown>[]>(
() => [
{
accessorKey: "id",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="ID" />
),
cell: ({ row }) => {
return <div className="w-[80px]">{row.getValue("id")}</div>;
},
filterFn: (row, id, value) => {
return row.original.id === value;
},
},
{
accessorKey: "title",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Title" />
),
cell: ({ row }) => {
return <div className="w-[80px]">{row.getValue("title")}</div>;
},
},
{
accessorKey: "numberOfWords",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Word Count" />
),
cell: ({ row }) => {
return (
<span className="ml-6 font-bold">
<Badge variant="secondary" className="!rounded-md !px-2">
{row.getValue("numberOfWords")}
</Badge>
</span>
);
},
},
{
accessorKey: "time",
header: ({ column }) => (
<DataTableColumnHeader column={column} title={"Created Date"} />
),
cell: ({ row }) => {
const timeValue = row.original.updatedDate;
const dateObj = new Date(timeValue);
const formattedDate = dateObj.toLocaleString();
return <span>{formattedDate}</span>;
},
enableSorting: false,
},
{
accessorKey: "published",
enableSorting: false,
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Public Status" />
),
cell: ({ row }) => {
return (
<div className="flex gap-x-1 items-center">
{row.original.published ? (
<MdPublic
className="mr-2 h-4 w-4 text-muted-foreground"
size={14}
/>
) : (
<MdPublicOff
className="mr-2 h-4 w-4 text-muted-foreground"
size={14}
/>
)}
<p>{row.original.published ? "Public" : "Private"}</p>
</div>
);
},
},
],
[data]
);

return (
<DataTable
columns={columns}
data={data}
pageCount={10}
// Render notion like filters
advancedFilter={false}
// Render dynamic searchable filters
searchableColumns={[
{
id: "title",
title: "titles",
},
]}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
"use client";

import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu";
import {
Button,
Checkbox,
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
} from "@wordigo/ui";
import { FlipHorizontal } from "lucide-react";
import { useTranslation } from "next-i18next";

import { Button, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent } from "@wordigo/ui";

export function DataTableViewOptions({ table }: { table: any }) {
const { t } = useTranslation();
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button className="px-4 py-[10px] font-semibold text-sm" variant="outline">
<Button
className="px-4 py-[10px] font-semibold text-sm"
variant="outline"
>
<FlipHorizontal className="mr-2 h-4 w-4" />
{t("table.columns")}
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-[150px] p-1">
{table
.getAllColumns()
.filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide())
.filter(
(column) =>
typeof column.accessorFn !== "undefined" && column.getCanHide()
)
.map((column) => {
return (
<DropdownMenuCheckboxItem
key={column.id}
className="capitalize"
checked={column.getIsVisible()}
onCheckedChange={(value) => column.toggleVisibility(!!value)}
>
<DropdownMenuCheckboxItem key={column.id} className="capitalize">
<Checkbox
checked={column.getIsVisible()}
onCheckedChange={(value) => column.toggleVisibility(!!value)}
/>
<span className="truncate">{column.id}</span>
</DropdownMenuCheckboxItem>
);
Expand Down
14 changes: 7 additions & 7 deletions apps/next/src/components/Dashboard/Words/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { DataTablePagination } from "./data-table-pagination";
import { DataTableToolbar } from "./data-table-toolbar";
import TableColumLoader from "./table.loader";
import {
type ColumnDef,
type ColumnFiltersState,
type SortingState,
type VisibilityState,
flexRender,
getCoreRowModel,
getFacetedRowModel,
Expand All @@ -14,12 +10,16 @@ import {
getPaginationRowModel,
getSortedRowModel,
useReactTable,
type ColumnDef,
type ColumnFiltersState,
type SortingState,
type VisibilityState,
} from "@tanstack/react-table";
import {
Table,
TableBody,
TableCell,
TableHeadWord,
TableHead,
TableHeader,
TableRow,
} from "@wordigo/ui";
Expand Down Expand Up @@ -79,7 +79,7 @@ export function DataTable<TData, TValue>({
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => {
return (
<TableHeadWord
<TableHead
key={header.id}
className={header.id === "select" && "!pl-4 text-start"}
>
Expand All @@ -89,7 +89,7 @@ export function DataTable<TData, TValue>({
header.column.columnDef.header,
header.getContext()
)}
</TableHeadWord>
</TableHead>
);
})}
</TableRow>
Expand Down
3 changes: 1 addition & 2 deletions apps/next/src/components/Dashboard/Words/table.loader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Fragment } from "react";

import { Skeleton, TableCell, TableRow } from "@wordigo/ui";
import { Fragment } from "react";

const TableColumLoader = () => {
return (
Expand Down
Loading

0 comments on commit fc240f7

Please sign in to comment.