Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191
This commit is contained in:
752
chat/templates/Community Suggestions/public/css/public-style.css
Normal file
752
chat/templates/Community Suggestions/public/css/public-style.css
Normal file
@@ -0,0 +1,752 @@
|
||||
/* Community Suggestions Frontend Styles */
|
||||
.pc-community-suggestions-container {
|
||||
/* Palette (used throughout the plugin to avoid inheriting theme styles) */
|
||||
--pc-primary: #2563eb; /* main blue */
|
||||
--pc-primary-strong: #1e40af;
|
||||
--pc-accent: #06b6d4;
|
||||
--pc-success: #059669;
|
||||
--pc-muted: #64748b;
|
||||
--pc-text: #000000; /* make body text pure black to stand out */
|
||||
--pc-heading: #000000; /* headings black for emphasis */
|
||||
--pc-card-bg: #ffffff; /* keep cards white */
|
||||
--pc-card-border: #e6f2fb;
|
||||
--pc-input-bg: #ffffff;
|
||||
--pc-card-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
|
||||
--pc-radius: 12px;
|
||||
|
||||
max-width: 880px;
|
||||
margin: 0 auto;
|
||||
padding: 30px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Enforce plugin palette with higher specificity so theme defaults don't leak in */
|
||||
.pc-community-suggestions-container .pc-button-primary {
|
||||
background: var(--pc-primary) !important;
|
||||
border-color: var(--pc-primary) !important;
|
||||
color: #fff !important;
|
||||
box-shadow: 0 6px 18px rgba(37,99,235,0.12);
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-button-primary:hover {
|
||||
background: var(--pc-primary-strong) !important;
|
||||
border-color: var(--pc-primary-strong) !important;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-button-secondary {
|
||||
background: #f1f5f9;
|
||||
color: var(--pc-text);
|
||||
border-color: #e2e8f0;
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-suggestion-card {
|
||||
background: var(--pc-card-bg);
|
||||
border: 1px solid var(--pc-card-border);
|
||||
box-shadow: var(--pc-card-shadow);
|
||||
border-radius: var(--pc-radius);
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-form-card {
|
||||
background: var(--pc-card-bg) !important;
|
||||
border: 1px solid var(--pc-card-border);
|
||||
box-shadow: var(--pc-card-shadow);
|
||||
border-radius: calc(var(--pc-radius) - 2px);
|
||||
}
|
||||
|
||||
/* Inputs */
|
||||
.pc-community-suggestions-container .pc-form-group input,
|
||||
.pc-community-suggestions-container .pc-form-group textarea,
|
||||
.pc-community-suggestions-container .pc-sort-dropdown select {
|
||||
background: var(--pc-input-bg);
|
||||
border-color: #e6eef8;
|
||||
color: var(--pc-text);
|
||||
}
|
||||
|
||||
/* Vote button */
|
||||
.pc-community-suggestions-container .pc-vote-button {
|
||||
border-color: var(--pc-success);
|
||||
background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 100%);
|
||||
box-shadow: 0 6px 12px rgba(5,150,105,0.12);
|
||||
border-radius: 10px;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-vote-button:hover:not(:disabled) {
|
||||
transform: scale(1.04);
|
||||
}
|
||||
|
||||
/* Headings and text */
|
||||
.pc-community-suggestions-container .pc-suggestions-header h2 { color: var(--pc-heading); }
|
||||
.pc-community-suggestions-container .pc-suggestion-title { color: var(--pc-heading); }
|
||||
.pc-community-suggestions-container .pc-suggestion-body { color: var(--pc-text); }
|
||||
|
||||
/* Links */
|
||||
.pc-community-suggestions-container .pc-back-link { color: var(--pc-primary); }
|
||||
.pc-community-suggestions-container .pc-back-link:hover { color: var(--pc-primary-strong); }
|
||||
|
||||
|
||||
/* Apply box-sizing to all elements */
|
||||
.pc-community-suggestions-container *,
|
||||
.pc-community-suggestions-container *::before,
|
||||
.pc-community-suggestions-container *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pc-suggestions-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.pc-suggestions-header h2 {
|
||||
font-size: 2em;
|
||||
font-weight: 700;
|
||||
color: #1e3a5f;
|
||||
margin: 0;
|
||||
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.pc-suggestions-controls {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pc-sort-dropdown select {
|
||||
padding: 10px 15px;
|
||||
border: 2px solid #8b5cf6;
|
||||
border-radius: 8px;
|
||||
background: #faf5ff;
|
||||
font-size: 14px;
|
||||
color: #1e0533;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.pc-sort-dropdown select:focus {
|
||||
outline: none;
|
||||
border-color: #7c3aed;
|
||||
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
|
||||
}
|
||||
|
||||
/* Button styles */
|
||||
.pc-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 12px 24px;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease-in-out;
|
||||
min-height: 44px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pc-button-primary {
|
||||
background: #3b82f6;
|
||||
color: #fff;
|
||||
border-color: #3b82f6;
|
||||
}
|
||||
|
||||
.pc-button-primary:hover {
|
||||
background: #2563eb;
|
||||
border-color: #2563eb;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
|
||||
}
|
||||
|
||||
.pc-button-primary:active {
|
||||
transform: translateY(0);
|
||||
box-shadow: 0 2px 6px rgba(34, 113, 177, 0.2);
|
||||
}
|
||||
|
||||
/* Suggestion form */
|
||||
.pc-suggestion-form {
|
||||
margin-bottom: 30px;
|
||||
animation: pc-slide-down 0.3s ease-out;
|
||||
}
|
||||
|
||||
.pc-form-card {
|
||||
background: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
|
||||
border: 2px solid #f59e0b;
|
||||
border-radius: 12px;
|
||||
padding: 25px;
|
||||
box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
|
||||
}
|
||||
|
||||
.pc-form-card h3 {
|
||||
margin: 0 0 20px 0;
|
||||
font-size: 1.3em;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.pc-form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.pc-form-group label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
color: #0f172a;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.pc-form-group input,
|
||||
.pc-form-group textarea {
|
||||
width: 100%;
|
||||
padding: 12px 16px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
transition: all 0.3s ease-in-out;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.pc-form-group input:focus,
|
||||
.pc-form-group textarea:focus {
|
||||
outline: none;
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
|
||||
background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
|
||||
}
|
||||
|
||||
.pc-form-group textarea {
|
||||
min-height: 120px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.pc-form-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* Suggestions list */
|
||||
.pc-suggestions-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.pc-no-suggestions {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: #ef4444;
|
||||
font-style: italic;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
/* Suggestion card */
|
||||
.pc-suggestion-card {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
background: var(--pc-card-bg) !important;
|
||||
border: 1px solid var(--pc-card-border) !important;
|
||||
border-radius: 16px;
|
||||
padding: 20px;
|
||||
box-shadow: var(--pc-card-shadow);
|
||||
transition: all 0.3s ease-in-out;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pc-suggestion-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
|
||||
border-color: var(--pc-card-border);
|
||||
background: var(--pc-card-bg) !important; /* keep background white */
|
||||
}
|
||||
|
||||
.pc-suggestion-card.pc-suggestion-hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
|
||||
border-color: #c3c4c7;
|
||||
}
|
||||
|
||||
.pc-suggestion-vote {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.pc-vote-button {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 2px solid #10b981;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease-in-out;
|
||||
padding: 0;
|
||||
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
|
||||
}
|
||||
|
||||
.pc-vote-button:hover:not(:disabled) {
|
||||
border-color: #059669;
|
||||
background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
|
||||
transform: scale(1.1);
|
||||
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
|
||||
}
|
||||
|
||||
.pc-vote-button.pc-voted {
|
||||
background: linear-gradient(135deg, #059669 0%, #047857 100%);
|
||||
border-color: #047857;
|
||||
color: #ffffff;
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
|
||||
}
|
||||
|
||||
.pc-vote-button:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.pc-vote-button.pc-vote-disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.pc-vote-arrow {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.pc-vote-count {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #2c3338;
|
||||
}
|
||||
|
||||
.pc-vote-button.pc-voted .pc-vote-count {
|
||||
color: #2a6b2a;
|
||||
}
|
||||
|
||||
.pc-suggestion-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pc-suggestion-title {
|
||||
font-size: 1.2em;
|
||||
font-weight: 600;
|
||||
margin: 0 0 12px 0;
|
||||
color: #000000 !important; /* enforce black heading */
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.pc-suggestion-body {
|
||||
margin-bottom: 16px;
|
||||
color: #000000 !important; /* enforce black body text */
|
||||
line-height: 1.6;
|
||||
font-size: 1.05em;
|
||||
}
|
||||
|
||||
.pc-suggestion-body p {
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
|
||||
.pc-suggestion-body p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.pc-suggestion-meta {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.pc-suggestion-author {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.pc-suggestion-date {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.pc-suggestion-actions {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.pc-button-small {
|
||||
padding: 8px 16px;
|
||||
font-size: 13px;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.pc-back-link {
|
||||
color: #3b82f6;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.pc-back-link:hover {
|
||||
color: #2563eb;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.pc-suggestion-detail {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.pc-suggestion-card.pc-suggestion-card-detail {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.pc-comments-section {
|
||||
background: linear-gradient(135deg, #ffffff 0%, #faf5ff 100%);
|
||||
border: 2px solid #a855f7;
|
||||
border-radius: 16px;
|
||||
padding: 25px;
|
||||
margin-top: 30px;
|
||||
box-shadow: 0 4px 15px rgba(168, 85, 247, 0.15);
|
||||
}
|
||||
|
||||
.pc-comments-section h3 {
|
||||
margin: 0 0 20px 0;
|
||||
font-size: 1.2em;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.pc-comment-card {
|
||||
border-left: 4px solid #a855f7;
|
||||
padding-left: 15px;
|
||||
margin-bottom: 20px;
|
||||
background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
|
||||
border-radius: 8px;
|
||||
padding: 15px 15px 15px 20px;
|
||||
box-shadow: 0 2px 8px rgba(168, 85, 247, 0.1);
|
||||
}
|
||||
|
||||
.pc-comment-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.pc-comment-author {
|
||||
font-weight: 600;
|
||||
color: #2c3338;
|
||||
}
|
||||
|
||||
.pc-comment-date {
|
||||
color: #646970;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.pc-comment-content {
|
||||
line-height: 1.6;
|
||||
color: #2c3338;
|
||||
}
|
||||
|
||||
.pc-comment-content p {
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
|
||||
.pc-comment-content p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.pc-no-comments {
|
||||
text-align: center;
|
||||
color: #7c3aed;
|
||||
font-style: italic;
|
||||
padding: 20px;
|
||||
background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
|
||||
border-radius: 8px;
|
||||
border: 2px solid #c4b5fd;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.pc-char-counter {
|
||||
font-size: 12px;
|
||||
color: #646970;
|
||||
margin-top: 5px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.pc-counter-exceeded {
|
||||
color: #d63638;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Login required */
|
||||
.pc-community-suggestions-login-required {
|
||||
max-width: 500px;
|
||||
margin: 40px auto;
|
||||
}
|
||||
|
||||
.pc-suggestions-card {
|
||||
background: #fff;
|
||||
border: 1px solid #dcdcde;
|
||||
border-radius: 12px;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.pc-suggestions-card h3 {
|
||||
font-size: 1.5em;
|
||||
font-weight: 600;
|
||||
margin: 0 0 15px 0;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
.pc-suggestions-card p {
|
||||
margin: 0 0 25px 0;
|
||||
color: #646970;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.pc-suggestions-actions {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
.pc-suggestions-pagination {
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pc-suggestions-pagination .page-numbers {
|
||||
display: inline-flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes pc-slide-down {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pc-fade-in-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.pc-suggestion-card {
|
||||
animation: pc-fade-in-up 0.4s ease-out;
|
||||
}
|
||||
|
||||
/* Responsive design */
|
||||
@media screen and (max-width: 768px) {
|
||||
.pc-community-suggestions-container {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.pc-suggestions-header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pc-suggestions-header h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.pc-suggestions-controls {
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.pc-suggestion-card {
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.pc-suggestion-vote {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pc-vote-button {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
flex-direction: row;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.pc-form-card {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.pc-form-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.pc-suggestions-actions {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pc-suggestion-meta {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
.pc-suggestions-header h2 {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.pc-button {
|
||||
padding: 10px 20px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pc-form-group input,
|
||||
.pc-form-group textarea {
|
||||
font-size: 14px;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
|
||||
.pc-suggestion-title {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dark mode support using the same variable palette (keeps styles consistent across themes) */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.pc-community-suggestions-container {
|
||||
--pc-primary: #60a5fa;
|
||||
--pc-primary-strong: #3b82f6;
|
||||
--pc-accent: #0891b2;
|
||||
--pc-success: #10b981;
|
||||
--pc-muted: #9ca3af;
|
||||
--pc-text: #e6eef8;
|
||||
--pc-heading: #ffffff;
|
||||
--pc-card-bg: #0b1220;
|
||||
--pc-card-border: #374151;
|
||||
--pc-input-bg: #0b1220;
|
||||
--pc-card-shadow: 0 6px 20px rgba(2,6,23,0.6);
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-form-group input,
|
||||
.pc-community-suggestions-container .pc-form-group textarea,
|
||||
.pc-community-suggestions-container .pc-sort-dropdown select {
|
||||
background: var(--pc-input-bg);
|
||||
border-color: var(--pc-card-border);
|
||||
color: var(--pc-text);
|
||||
}
|
||||
|
||||
/* Force white cards and black text even in dark mode as requested */
|
||||
.pc-community-suggestions-container .pc-form-card,
|
||||
.pc-community-suggestions-container .pc-suggestion-card {
|
||||
background: #ffffff !important;
|
||||
color: #000000 !important;
|
||||
border-color: #e6f2fb !important;
|
||||
box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06) !important;
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-suggestion-card:hover {
|
||||
background: #ffffff !important;
|
||||
border-color: #e6f2fb !important;
|
||||
box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12) !important;
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-suggestion-title,
|
||||
.pc-community-suggestions-container .pc-suggestion-body {
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-form-group input,
|
||||
.pc-community-suggestions-container .pc-form-group textarea,
|
||||
.pc-community-suggestions-container .pc-sort-dropdown select {
|
||||
background: #ffffff !important;
|
||||
color: #000000 !important;
|
||||
border-color: #e6eef8 !important;
|
||||
}
|
||||
|
||||
.pc-community-suggestions-container .pc-comment-card { border-left-color: var(--pc-accent); }
|
||||
}
|
||||
|
||||
/* Accessibility improvements */
|
||||
.pc-vote-button:focus {
|
||||
outline: 2px solid #2271b1;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.pc-button:focus,
|
||||
.pc-form-group input:focus,
|
||||
.pc-form-group textarea:focus,
|
||||
.pc-sort-dropdown select:focus {
|
||||
outline: 2px solid #2271b1;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* High contrast mode */
|
||||
@media (prefers-contrast: high) {
|
||||
.pc-suggestion-card {
|
||||
border: 2px solid #000;
|
||||
}
|
||||
|
||||
.pc-vote-button {
|
||||
border: 2px solid #000;
|
||||
}
|
||||
|
||||
.pc-button {
|
||||
border: 2px solid #000;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reduced motion */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.pc-suggestion-card,
|
||||
.pc-suggestion-form,
|
||||
.pc-button,
|
||||
.pc-vote-button {
|
||||
transition: none;
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.pc-button:hover,
|
||||
.pc-vote-button:hover {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
265
chat/templates/Community Suggestions/public/js/public-script.js
Normal file
265
chat/templates/Community Suggestions/public/js/public-script.js
Normal file
@@ -0,0 +1,265 @@
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
// Toggle suggestion form
|
||||
window.pcToggleSuggestionForm = function() {
|
||||
const form = document.getElementById('pc-suggestion-form');
|
||||
if (form.style.display === 'none') {
|
||||
form.style.display = 'block';
|
||||
form.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
} else {
|
||||
form.style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
// Change sort method
|
||||
window.pcChangeSort = function(sort) {
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.set('sort', sort);
|
||||
window.location.href = url.toString();
|
||||
};
|
||||
|
||||
// Handle suggestion submission
|
||||
$('#pc-new-suggestion-form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const form = $(this);
|
||||
const submitBtn = form.find('button[type="submit"]');
|
||||
const title = $('#pc-suggestion-title').val().trim();
|
||||
const content = $('#pc-suggestion-content').val().trim();
|
||||
|
||||
// Basic validation
|
||||
if (!title || !content) {
|
||||
alert(pcCommunitySuggestions.i18n.fill_all_fields);
|
||||
return;
|
||||
}
|
||||
|
||||
if (title.length > 255) {
|
||||
alert(pcCommunitySuggestions.i18n.title_too_long);
|
||||
return;
|
||||
}
|
||||
|
||||
submitBtn.prop('disabled', true).addClass('pc-loading');
|
||||
|
||||
$.ajax({
|
||||
url: pcCommunitySuggestions.ajax_url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'pc_submit_suggestion',
|
||||
title: title,
|
||||
content: content,
|
||||
nonce: pcCommunitySuggestions.nonce
|
||||
},
|
||||
success: function(response) {
|
||||
console.log('AJAX Response:', response);
|
||||
if (response.success) {
|
||||
// Clear form and show success message
|
||||
form[0].reset();
|
||||
pcToggleSuggestionForm();
|
||||
|
||||
// Show success message
|
||||
pcShowMessage(response.data.message, 'success');
|
||||
|
||||
// Reload page to show new suggestion
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 2000);
|
||||
} else {
|
||||
pcShowMessage(response.data.message, 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX Error:', status, error);
|
||||
console.error('Response Text:', xhr.responseText);
|
||||
console.error('Status Code:', xhr.status);
|
||||
if (xhr.responseText) {
|
||||
pcShowMessage('Error: ' + xhr.responseText.substring(0, 200) + '...', 'error');
|
||||
} else {
|
||||
pcShowMessage(pcCommunitySuggestions.i18n.ajax_error + ' (Status: ' + xhr.status + ')', 'error');
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
submitBtn.prop('disabled', false).removeClass('pc-loading');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle voting
|
||||
window.pcVoteSuggestion = function(suggestionId) {
|
||||
if (!pcCommunitySuggestions.is_user_logged_in) {
|
||||
alert(pcCommunitySuggestions.i18n.login_to_vote);
|
||||
return;
|
||||
}
|
||||
|
||||
const voteBtn = $(`.pc-vote-button[onclick*="${suggestionId}"]`);
|
||||
if (voteBtn.prop('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
voteBtn.prop('disabled', true).addClass('pc-loading');
|
||||
|
||||
$.ajax({
|
||||
url: pcCommunitySuggestions.ajax_url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'pc_vote_suggestion',
|
||||
suggestion_id: suggestionId,
|
||||
nonce: pcCommunitySuggestions.nonce
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// Update UI
|
||||
const voteCount = voteBtn.find('.pc-vote-count');
|
||||
const currentVotes = parseInt(voteCount.text());
|
||||
voteCount.text(currentVotes + 1);
|
||||
|
||||
voteBtn.addClass('pc-voted');
|
||||
voteBtn.find('.pc-vote-arrow').css('color', '#2a6b2a');
|
||||
|
||||
pcShowMessage(response.data.message, 'success');
|
||||
} else {
|
||||
pcShowMessage(response.data.message, 'error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
pcShowMessage(pcCommunitySuggestions.i18n.ajax_error, 'error');
|
||||
},
|
||||
complete: function() {
|
||||
voteBtn.removeClass('pc-loading');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Show message function
|
||||
function pcShowMessage(message, type = 'info') {
|
||||
// Remove existing messages
|
||||
$('.pc-message').remove();
|
||||
|
||||
const messageClass = `pc-message pc-message-${type}`;
|
||||
const messageHtml = `
|
||||
<div class="${messageClass}">
|
||||
<p>${message}</p>
|
||||
<button class="pc-message-close" onclick="$(this).parent().fadeOut(300, function() { $(this).remove(); })">
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
$('.pc-suggestions-header').after(messageHtml);
|
||||
|
||||
// Auto-hide after 5 seconds
|
||||
setTimeout(() => {
|
||||
$('.pc-message').fadeOut(300, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// Add message styles dynamically
|
||||
$('<style>')
|
||||
.text(`
|
||||
.pc-message {
|
||||
padding: 15px 20px;
|
||||
margin: 20px 0;
|
||||
border-radius: 6px;
|
||||
border-left: 4px solid;
|
||||
position: relative;
|
||||
animation: pc-slide-in 0.3s ease-out;
|
||||
}
|
||||
|
||||
.pc-message-success {
|
||||
background: #edfaef;
|
||||
border-color: #00a32a;
|
||||
color: #2a6b2a;
|
||||
}
|
||||
|
||||
.pc-message-error {
|
||||
background: #fcf0f1;
|
||||
border-color: #d63638;
|
||||
color: #b32d2e;
|
||||
}
|
||||
|
||||
.pc-message-info {
|
||||
background: #f0f6ff;
|
||||
border-color: #2271b1;
|
||||
color: #135e96;
|
||||
}
|
||||
|
||||
.pc-message-close {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
@keyframes pc-slide-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
`)
|
||||
.appendTo('head');
|
||||
|
||||
// Add loading class styles
|
||||
$('<style>')
|
||||
.text(`
|
||||
.pc-loading {
|
||||
opacity: 0.7;
|
||||
pointer-events: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pc-loading::after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid #f3f3f3;
|
||||
border-top: 2px solid #2271b1;
|
||||
border-radius: 50%;
|
||||
animation: pc-spin 1s linear infinite;
|
||||
margin-left: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@keyframes pc-spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
`)
|
||||
.appendTo('head');
|
||||
|
||||
|
||||
|
||||
// Handle enter key in form
|
||||
$('#pc-suggestion-title, #pc-suggestion-content').on('keydown', function(e) {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
$('#pc-new-suggestion-form').submit();
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-resize textarea
|
||||
$('#pc-suggestion-content').on('input', function() {
|
||||
this.style.height = 'auto';
|
||||
this.style.height = (this.scrollHeight) + 'px';
|
||||
}).trigger('input');
|
||||
|
||||
// Focus on title field when form opens
|
||||
$(document).on('click', '#pc-suggestion-form', function(e) {
|
||||
if (e.target === this) {
|
||||
$('#pc-suggestion-title').focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user