You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. 'use client';
  2. import React from 'react';
  3. import PageTitle from '@/components/ui/PageTitle';
  4. import {
  5. EyeOutlined,
  6. EditOutlined,
  7. SortAscendingOutlined,
  8. PlusCircleFilled
  9. } from '@ant-design/icons';
  10. type SourcePersonaItem = {
  11. id: number;
  12. persona_name: string;
  13. knowledge_source: string[];
  14. }
  15. const sourcePersonas: SourcePersonaItem[] = [
  16. {
  17. id: 1,
  18. persona_name: "Bella",
  19. knowledge_source: ["Refund Policy", "Pricing SOP"],
  20. },
  21. {
  22. id: 2,
  23. persona_name: "Rafiq",
  24. knowledge_source: ["Refund Policy", "Pricing SOP"],
  25. },
  26. {
  27. id: 3,
  28. persona_name: "Lina",
  29. knowledge_source: ["Response Templates", "Customer FAQ"],
  30. }
  31. ];
  32. const Knowledge: React.FC = () => {
  33. return (
  34. <main className="flex flex-col bg-white h-full">
  35. <PageTitle title="KNOWLEDGE SOURCES" />
  36. {sourcePersonas.length > 0 ? <KnowledgeList /> : <EmptyKnowledgeIntro />}
  37. </main>
  38. );
  39. };
  40. const EmptyKnowledgeIntro: React.FC = () => {
  41. return (
  42. <div className="flex flex-col px-6 flex-1 justify-center items-center">
  43. <div
  44. className="w-full max-w-md text-center border-2 border-cyan-500 rounded-lg px-6 py-10 shadow-lg"
  45. style={{ boxShadow: '0 10px 100px 30px rgba(59, 130, 246, 0.3)' }}
  46. >
  47. <p className="text-lg font-semibold mb-2 text-gray-800">NO SOURCE ADDED YET</p>
  48. <p className="text-sm text-gray-600 mb-4">Get started by adding your first knowledge source</p>
  49. <img
  50. src="/ruccan_logo.png"
  51. alt="Ruccan Logo"
  52. className="mx-auto mb-6"
  53. width={150}
  54. height={150}
  55. />
  56. <button className="w-fit rounded text-xs px-4 py-2 bg-[#369cc1] hover:bg-[#82c7d7] cursor-pointer text-white font-bold shadow transition-all duration-200">
  57. ADD FIRST SOURCE
  58. </button>
  59. </div>
  60. </div>
  61. );
  62. };
  63. const KnowledgeList: React.FC = () => {
  64. return (
  65. <div className="overflow-x-auto">
  66. <div className="flex px-2 py-4">
  67. <button className="w-fit rounded text-xs px-4 py-2 bg-[#369cc1] hover:bg-[#82c7d7] cursor-pointer text-white font-bold shadow transition-all duration-200 ms-auto">
  68. <PlusCircleFilled /> Add Source
  69. </button>
  70. </div>
  71. <table className="w-full text-sm text-left text-gray-700 border-collapse">
  72. <thead>
  73. <tr className="text-black">
  74. <th className="px-4 py-3 font-medium border border-gray-200">
  75. <div className="flex items-center gap-1 text-xs min-w-[80px]">
  76. AI persona <SortAscendingOutlined className="text-xs text-gray-400" />
  77. </div>
  78. </th>
  79. <th className="px-4 py-3 font-medium border border-gray-200">
  80. <div className="flex items-center gap-1 text-xs">
  81. Knowledge Sources <SortAscendingOutlined className="text-xs text-gray-400" />
  82. </div>
  83. </th>
  84. <th className="px-4 py-3 font-medium text-center border border-gray-200">Action</th>
  85. </tr>
  86. </thead>
  87. <tbody>
  88. {sourcePersonas.map((item) => (
  89. <tr key={item.id} className="border-t border-gray-200 hover:bg-gray-50">
  90. <td className="px-4 py-3">{item.persona_name}</td>
  91. <td className="px-4 py-3">
  92. {item.knowledge_source.join(', ')}
  93. </td>
  94. <td className="px-4 py-3 text-center">
  95. <div className="flex justify-center items-center gap-3 text-gray-600">
  96. <button className="hover:text-blue-500" aria-label="Edit" title="Edit">
  97. <EditOutlined />
  98. </button>
  99. <button className="hover:text-green-600" aria-label="View" title="View">
  100. <EyeOutlined />
  101. </button>
  102. </div>
  103. </td>
  104. </tr>
  105. ))}
  106. </tbody>
  107. </table>
  108. </div>
  109. );
  110. };
  111. export default Knowledge;